Skip to content

Instantly share code, notes, and snippets.

@yuhanz
Created November 17, 2024 01:18
Show Gist options
  • Select an option

  • Save yuhanz/466cb2931d859628a725a70a032afd76 to your computer and use it in GitHub Desktop.

Select an option

Save yuhanz/466cb2931d859628a725a70a032afd76 to your computer and use it in GitHub Desktop.
Youtube Video Download
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