Use yt-dlp to download videos from YouTube or Bilibili. Downloads go to the user's Videos folder (~/Videos).
yt-dlp must be installed:
yt-dlp --version
# Install if missing
pip install yt-dlp # cross-platform
winget install yt-dlp # Windows
brew install yt-dlp # macOS
sudo apt install yt-dlp # Debian/Ubuntu
ffmpeg is recommended for merging video+audio streams.
yt-dlp -o "<videos-dir>/%(title)s.%(ext)s" "<url>"
Replace with the user's Videos folder path, and with the video URL.
Supported URLs:
https://www.youtube.com/watch?v=... or https://youtu.be/...https://www.bilibili.com/video/BV...# YouTube
yt-dlp -o "<videos-dir>/%(title)s.%(ext)s" "ytsearch1:<title>"
# Bilibili
yt-dlp -o "<videos-dir>/%(title)s.%(ext)s" "bilisearch1:<title>"
| Goal | Flag |
|---|---|
| ------ | ------ |
| Best quality (default) | -f bestvideo+bestaudio/best |
| Audio only (mp3) | -x --audio-format mp3 |
| Specific resolution | -f "bestvideo[height<=720]+bestaudio" |
| Subtitles | --write-subs --sub-langs zh-Hans,en |
| Playlist (all videos) | just pass the playlist URL |
| Limit speed | --rate-limit 2M |
-f best (single stream).--cookies-from-browser chrome.ytsearch1: or bilisearch1: prefix共 1 个版本
暂无安全检测报告