Created
November 17, 2024 01:18
-
-
Save yuhanz/466cb2931d859628a725a70a032afd76 to your computer and use it in GitHub Desktop.
Youtube Video Download
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from yt_dlp import YoutubeDL | |
| # URL of the YouTube video | |
| video_url = "https://www.youtube.com/watch?v=example" | |
| # yt-dlp options | |
| ydl_opts = { | |
| "format": "mp4", # Download a progressive MP4 stream with both video and audio | |
| "outtmpl": "downloads/%(title)s.%(ext)s", # Output template | |
| } | |
| # Download the video | |
| with YoutubeDL(ydl_opts) as ydl: | |
| ydl.download([video_url]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment