使用 yt-dlp 从1000+网站(如YouTube、Bilibili、Twitter/X、TikTok、Vimeo、Instagram、Twitch等)下载视频。在用户分享时使用此技能。
Download videos from YouTube, Bilibili, Twitter/X, TikTok, and 1000+ other sites using yt-dlp.
bash
which yt-dlp && yt-dlp --version
which ffmpeg
If yt-dlp is missing, install it:
bash
# macOS
brew install yt-dlp ffmpeg
# Cross-platform
pip install yt-dlp
Use the bundled script — it wraps yt-dlp with sensible defaults and clear error messages.
bash
python3 scripts/download.py "VIDEO_URL"
Default output: ~/Downloads/Videos/
bash
python3 scripts/download.py "URL" -f 1080 # Max 1080p
python3 scripts/download.py "URL" -a # Audio only (MP3)
python3 scripts/download.py "URL" -F # List formats
python3 scripts/download.py "URL" --subs # With subtitles
python3 scripts/download.py "URL" -o ~/Desktop # Custom output dir
python3 scripts/download.py "URL" --cookies chrome # Use browser cookies
For cases the script doesn't cover, use yt-dlp directly:
bash
# Download playlist
yt-dlp -P ~/Downloads/Videos "PLAYLIST_URL"
# Custom filename template
yt-dlp -o "%(uploader)s - %(title)s.%(ext)s" "VIDEO_URL"
# Download with subtitles in specific languages
yt-dlp --write-subs --sub-lang zh,en -P ~/Downloads/Videos "VIDEO_URL"
Most download failures fall into these categories:
SymptomFix"Sign in required" or age-restrictedAdd --cookies chrome to use browser sessionOnly low quality availableUpdate yt-dlp ( brew upgrade yt-dlp), then try with --cookies chromeSlow downloadsTry --concurrent-fragments 3 or --downloader aria2cNetwork errors (behind firewall)Use --proxy socks5://127.0.0.1:1080 or set ALL_PROXY env var
For platform-specific details (YouTube PO tokens, Bilibili series, TikTok watermark removal, etc.), see references/platform-tips.md.