yt-dlp Video Downloader
Download videos and audio from YouTube and 1000+ websites.
Prerequisites
Check if yt-dlp is installed before downloading:
which yt-dlp && yt-dlp --version
If not installed:
# macOS
brew install yt-dlp ffmpeg
# Or via pip
pip install yt-dlp
Quick Start
When user provides a video URL:
# Default: best quality video
yt-dlp "URL"
# Audio only (mp3)
yt-dlp -x --audio-format mp3 "URL"
# Specify output directory
yt-dlp -o "~/Downloads/%(title)s.%(ext)s" "URL"
Common Tasks
Download Video
# Best quality (default)
yt-dlp "URL"
# Limit to 1080p
yt-dlp -f "bestvideo[height<=1080]+bestaudio/best[height<=1080]" "URL"
# Limit to 720p
yt-dlp -f "bestvideo[height<=720]+bestaudio/best[height<=720]" "URL"
# List available formats first
yt-dlp -F "URL"
Extract Audio
# Extract as mp3
yt-dlp -x --audio-format mp3 "URL"
# Extract as m4a (better quality)
yt-dlp -x --audio-format m4a "URL"
Download Playlist
# Entire playlist
yt-dlp "PLAYLIST_URL"
# Specific items
yt-dlp --playlist-items 1-5 "PLAYLIST_URL"
# Single video only (ignore playlist)
yt-dlp --no-playlist "URL"
Subtitles
# Download with subtitles
yt-dlp --write-subs --sub-langs en,zh "URL"
# Embed subtitles in video
yt-dlp --embed-subs "URL"
Output Options
# Custom output path
yt-dlp -o "~/Downloads/%(title)s.%(ext)s" "URL"
# Include uploader in filename
yt-dlp -o "%(uploader)s - %(title)s.%(ext)s" "URL"
Workflow
- User provides video URL
- Ask for preferences if not specified:
- Video or audio only?
- Quality preference?
- Output location? (default: current directory)
- Check yt-dlp is installed
- Run appropriate command
- Report download result
Troubleshooting
# Update yt-dlp
yt-dlp -U
# Use browser cookies for login-required content
yt-dlp --cookies-from-browser chrome "URL"
# Verbose output
yt-dlp -v "URL"