youtube-downloader
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseYouTube Video Downloader (yt-dlp)
YouTube视频下载工具(yt-dlp)
Download videos from YouTube and 1000+ other sites using yt-dlp.
使用yt-dlp从YouTube及1000+其他平台下载视频。
Description
功能说明
A powerful video downloader skill based on yt-dlp that supports YouTube, Bilibili, Twitter/X, TikTok, and many other platforms. Features include format selection, audio extraction, subtitle download, playlist support, and metadata preservation.
一款基于yt-dlp的强大视频下载工具,支持YouTube、Bilibili、Twitter/X、TikTok等众多平台。功能包括格式选择、音频提取、字幕下载、播放列表支持以及元数据保留。
When to Use
使用场景
Use this skill when users:
- Provide YouTube URLs and want to download videos
- Mention "download video", "下载视频", "save video from YouTube"
- Want to extract audio from videos (MP3)
- Need to download playlists or channels
- Want subtitles/captions from videos
- Request video download from supported sites (Bilibili, Twitter, TikTok, etc.)
当用户出现以下需求时可使用本工具:
- 提供YouTube链接并希望下载视频时
- 提及“download video”、“下载视频”、“save video from YouTube”时
- 希望从视频中提取音频(MP3格式)时
- 需要下载播放列表或频道内容时
- 想要获取视频字幕/字幕文件时
- 请求从支持的平台(Bilibili、Twitter、TikTok等)下载视频时
Features
核心功能
- Multi-Platform Support: YouTube, Bilibili, Twitter/X, TikTok, Vimeo, and 1000+ sites
- Format Selection: Choose video quality (1080p, 720p, 4K) or audio-only
- Audio Extraction: Extract audio as MP3, M4A, or other formats
- Subtitle Download: Auto-download subtitles in multiple languages
- Playlist Support: Download entire playlists or channels
- Metadata Preservation: Save video info, thumbnails, and descriptions
- Resume Support: Continue interrupted downloads
- Progress Display: Real-time download progress
- 多平台支持:YouTube、Bilibili、Twitter/X、TikTok、Vimeo及1000+其他平台
- 格式选择:可选择视频画质(1080p、720p、4K)或仅音频模式
- 音频提取:可将音频提取为MP3、M4A等格式
- 字幕下载:自动下载多语言字幕
- 播放列表支持:下载整个播放列表或频道内容
- 元数据保留:保存视频信息、缩略图及描述
- 断点续传:恢复中断的下载任务
- 进度显示:实时展示下载进度
Usage
使用方法
Basic Syntax
基本语法
bash
python scripts/download_video.py "VIDEO_URL" [OPTIONS]bash
python scripts/download_video.py "VIDEO_URL" [OPTIONS]Common Scenarios
常见使用场景
Download single video (best quality):
bash
python scripts/download_video.py "https://www.youtube.com/watch?v=dQw4w9WgXcQ"Download video in specific quality:
bash
python scripts/download_video.py "https://www.youtube.com/watch?v=VIDEO_ID" -f 1080Extract audio only (MP3):
bash
python scripts/download_video.py "https://www.youtube.com/watch?v=VIDEO_ID" --audio-onlyDownload with subtitles:
bash
python scripts/download_video.py "https://www.youtube.com/watch?v=VIDEO_ID" --subtitlesDownload playlist:
bash
python scripts/download_video.py "https://www.youtube.com/playlist?list=PLAYLIST_ID" --playlistDownload N videos from playlist:
bash
python scripts/download_video.py "https://www.youtube.com/playlist?list=PLAYLIST_ID" --playlist -n 5Specify output directory:
bash
python scripts/download_video.py "URL" -o /path/to/output下载单个视频(最佳画质):
bash
python scripts/download_video.py "https://www.youtube.com/watch?v=dQw4w9WgXcQ"下载指定画质的视频:
bash
python scripts/download_video.py "https://www.youtube.com/watch?v=VIDEO_ID" -f 1080仅提取音频(MP3格式):
bash
python scripts/download_video.py "https://www.youtube.com/watch?v=VIDEO_ID" --audio-only下载视频及字幕:
bash
python scripts/download_video.py "https://www.youtube.com/watch?v=VIDEO_ID" --subtitles下载播放列表:
bash
python scripts/download_video.py "https://www.youtube.com/playlist?list=PLAYLIST_ID" --playlist下载播放列表中的前N个视频:
bash
python scripts/download_video.py "https://www.youtube.com/playlist?list=PLAYLIST_ID" --playlist -n 5指定输出目录:
bash
python scripts/download_video.py "URL" -o /path/to/outputArguments
参数说明
| Argument | Description | Default |
|---|---|---|
| Video/Playlist URL (required) | - |
| Output directory | Current directory |
| Video quality: | |
| Extract audio only (MP3) | False |
| Download subtitles | False |
| Subtitle language(s) | |
| Enable playlist download | False |
| Number of videos from playlist | All |
| Save video metadata JSON | True |
| Download thumbnail | False |
| Path to cookies file (for age-restricted content) | None |
| 参数 | 说明 | 默认值 |
|---|---|---|
| 视频/播放列表链接(必填) | - |
| 输出目录 | 当前目录 |
| 视频画质选项: | |
| 启用仅音频提取模式(MP3格式) | False |
| 开启字幕下载 | False |
| 字幕语言选项 | |
| 启用播放列表下载模式 | False |
| 从播放列表中下载的视频数量 | 全部 |
| 保存视频元数据至JSON文件 | True |
| 下载视频缩略图 | False |
| Cookie文件路径(用于访问年龄限制内容) | None |
Dependencies
依赖安装
bash
undefinedbash
undefinedInstall yt-dlp
安装yt-dlp
pip install yt-dlp --break-system-packages
pip install yt-dlp --break-system-packages
For audio extraction (optional)
用于音频提取(可选)
macOS
macOS系统
brew install ffmpeg
brew install ffmpeg
Ubuntu/Debian
Ubuntu/Debian系统
apt-get install ffmpeg
undefinedapt-get install ffmpeg
undefinedOutput Structure
输出结构
Single Video
单个视频输出
OutputDir/
├── Video Title [VIDEO_ID].mp4 # Video file
├── Video Title [VIDEO_ID].json # Metadata (if --metadata)
├── Video Title [VIDEO_ID].jpg # Thumbnail (if --thumbnail)
└── Video Title [VIDEO_ID].en.vtt # Subtitles (if --subtitles)OutputDir/
├── Video Title [VIDEO_ID].mp4 # 视频文件
├── Video Title [VIDEO_ID].json # 元数据文件(若启用--metadata)
├── Video Title [VIDEO_ID].jpg # 缩略图文件(若启用--thumbnail)
└── Video Title [VIDEO_ID].en.vtt # 字幕文件(若启用--subtitles)Playlist
播放列表输出
OutputDir/
└── PlaylistName/
├── playlist_info.json
├── 001 - Video Title.mp4
├── 001 - Video Title.json
├── 002 - Another Video.mp4
└── ...OutputDir/
└── PlaylistName/
├── playlist_info.json
├── 001 - Video Title.mp4
├── 001 - Video Title.json
├── 002 - Another Video.mp4
└── ...Metadata Example
元数据示例
json
{
"title": "Video Title",
"uploader": "Channel Name",
"upload_date": "2024-01-15",
"duration": 300,
"view_count": 1000000,
"description": "Video description...",
"tags": ["tag1", "tag2"],
"video_file": "Video Title [VIDEO_ID].mp4"
}json
{
"title": "Video Title",
"uploader": "Channel Name",
"upload_date": "2024-01-15",
"duration": 300,
"view_count": 1000000,
"description": "Video description...",
"tags": ["tag1", "tag2"],
"video_file": "Video Title [VIDEO_ID].mp4"
}Claude Integration
与Claude集成
When user requests video download:
-
Read skill documentation:python
view("/mnt/skills/user/youtube-downloader/SKILL.md") -
Install dependencies (if needed):bash
pip install yt-dlp --break-system-packages -
Execute download:bash
python /mnt/skills/user/youtube-downloader/scripts/download_video.py \ "USER_URL" -o /mnt/user-data/outputs -
Present files to user:python
present_files(["/mnt/user-data/outputs/..."])
当用户请求视频下载时:
-
查看技能文档:python
view("/mnt/skills/user/youtube-downloader/SKILL.md") -
安装依赖(如未安装):bash
pip install yt-dlp --break-system-packages -
执行下载:bash
python /mnt/skills/user/youtube-downloader/scripts/download_video.py \ "USER_URL" -o /mnt/user-data/outputs -
向用户交付文件:python
present_files(["/mnt/user-data/outputs/..."])
Supported Platforms
支持的平台
Major Platforms
主流平台
- YouTube: Videos, Shorts, Playlists, Channels, Live streams
- Bilibili: Videos, Episodes (may need cookies)
- Twitter/X: Video tweets
- TikTok: Videos (may need cookies)
- Vimeo: Videos
- Twitch: VODs, Clips
- YouTube: 普通视频、Shorts短视频、播放列表、频道、直播回放
- Bilibili: 普通视频、剧集(可能需要Cookie)
- Twitter/X: 视频推文
- TikTok: 短视频(可能需要Cookie)
- Vimeo: 视频内容
- Twitch: 点播视频(VODs)、精彩片段(Clips)
Full List
完整平台列表
yt-dlp supports 1000+ sites. Run for full list.
yt-dlp --list-extractorsyt-dlp支持1000+平台,运行可查看完整列表。
yt-dlp --list-extractorsCommon Issues
常见问题
Q: Age-restricted videos?
A: Use with exported browser cookies:
--cookies--cookies cookies.txtQ: Format not available?
A: Some videos may not have all quality options. Script will auto-select best available.
Q: Download speed slow?
A: This is usually server-side throttling. Consider using a VPN or waiting.
Q: Need to login for private videos?
A: Export cookies from your browser after logging in, then use .
--cookiesQ: Audio extraction fails?
A: Install ffmpeg: (macOS) or (Linux)
brew install ffmpegapt install ffmpegQ: 无法下载年龄限制的视频?
A: 使用参数配合导出的浏览器Cookie文件:
--cookies--cookies cookies.txtQ: 目标格式不可用?
A: 部分视频可能不支持所有画质选项,工具会自动选择可用的最佳画质。
Q: 下载速度缓慢?
A: 这通常是源服务器限流导致,可尝试使用VPN或稍后再试。
Q: 下载私人视频需要登录?
A: 登录浏览器后导出Cookie文件,然后使用参数。
--cookiesQ: 音频提取失败?
A: 安装ffmpeg工具:macOS系统使用,Linux系统使用
brew install ffmpegapt install ffmpegExample Conversations
对话示例
Install yt-dlp
安装yt-dlp
pip install yt-dlp --break-system-packages
pip install yt-dlp --break-system-packages
Download video
下载视频
python /mnt/skills/user/youtube-downloader/scripts/download_video.py
"https://www.youtube.com/watch?v=dQw4w9WgXcQ"
-o /mnt/user-data/outputs
"https://www.youtube.com/watch?v=dQw4w9WgXcQ"
-o /mnt/user-data/outputs
python /mnt/skills/user/youtube-downloader/scripts/download_video.py
"https://www.youtube.com/watch?v=dQw4w9WgXcQ"
-o /mnt/user-data/outputs
"https://www.youtube.com/watch?v=dQw4w9WgXcQ"
-o /mnt/user-data/outputs
Present files
交付文件
present_files([...])
---
**User**: "下载这个 YouTube 视频的音频,我只要 MP3"
**Claude**:
```bash
python /mnt/skills/user/youtube-downloader/scripts/download_video.py \
"VIDEO_URL" \
--audio-only \
-o /mnt/user-data/outputsUser: "Download this playlist, but only the first 5 videos"
Claude:
bash
python /mnt/skills/user/youtube-downloader/scripts/download_video.py \
"PLAYLIST_URL" \
--playlist -n 5 \
-o /mnt/user-data/outputspresent_files([...])
---
**用户**: "下载这个 YouTube 视频的音频,我只要 MP3"
**Claude**:
```bash
python /mnt/skills/user/youtube-downloader/scripts/download_video.py \
"VIDEO_URL" \
--audio-only \
-o /mnt/user-data/outputsUser: "Download this playlist, but only the first 5 videos"
Claude:
bash
python /mnt/skills/user/youtube-downloader/scripts/download_video.py \
"PLAYLIST_URL" \
--playlist -n 5 \
-o /mnt/user-data/outputsHow It Works
工作原理
Workflow
工作流程
- URL Parsing: Detect platform and content type (video/playlist)
- Format Selection: Determine best available format based on user preference
- Download: Stream video/audio with progress display
- Post-Processing: Extract audio (if requested), embed subtitles
- Metadata: Save video information to JSON
- URL解析: 检测平台及内容类型(视频/播放列表)
- 格式选择: 根据用户偏好确定最佳可用格式
- 下载任务: 流式下载视频/音频并展示进度
- 后处理: 提取音频(若请求)、嵌入字幕
- 元数据保存: 将视频信息保存至JSON文件
Under the Hood
底层实现
This skill wraps yt-dlp with sensible defaults:
- Automatic format selection for best quality
- Proper filename sanitization
- Retry logic for failed downloads
- Progress display with ETA
本工具基于yt-dlp封装,提供合理的默认配置:
- 自动选择最佳画质格式
- 文件名自动清理
- 失败下载的重试逻辑
- 带预计完成时间的进度显示
Limitations
局限性
- Some sites may require authentication (cookies)
- Age-restricted content needs browser cookies
- Download speed depends on source server
- Some DRM-protected content cannot be downloaded
- Live streams can only be downloaded after they end (VOD)
- 部分平台可能需要身份验证(Cookie)
- 年龄限制内容需要浏览器Cookie
- 下载速度取决于源服务器
- 受DRM保护的内容无法下载
- 直播内容仅能在结束后下载(转为点播视频)
Legal Notice
法律声明
This tool is for personal use only. Please respect:
- YouTube Terms of Service
- Copyright laws in your jurisdiction
- Content creators' rights
Only download content you have the right to access. Do not redistribute copyrighted material.
本工具仅用于个人使用。请遵守:
- YouTube服务条款
- 所在地区的版权法
- 内容创作者的权利
仅下载您有权访问的内容,请勿分发受版权保护的材料。
Version History
版本历史
v1.0 (Current)
- Initial release with yt-dlp wrapper
- Support for video, audio, subtitles, playlists
- Metadata and thumbnail preservation
- Multi-platform support
v1.0(当前版本)
- 初始版本,基于yt-dlp封装
- 支持视频、音频、字幕、播放列表下载
- 保留元数据和缩略图
- 多平台支持