yt-dlp
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseyt-dlp
yt-dlp
CLI skill for yt-dlp: read-only URL probes, caption/transcript extraction, and optional media download. Follow the transcript-first protocol before any download.
Scope: Supported video/audio hosts via , user-owned cookie files, playlist metadata, and local output under an explicit directory. NOT for: static page fetch (use Fetch MCP or ), broad multi-source research (), ffmpeg transform recipes (), or bypassing platform Terms of Service.
yt-dlpcurlresearchffmpeg用于yt-dlp的CLI技能:支持只读URL探测、字幕/转录文本提取,以及可选的媒体下载。在进行任何下载前,请遵循先转录协议。
适用范围: 通过支持的视频/音频平台、用户自有Cookie文件、播放列表元数据,以及指定目录下的本地输出。不适用场景: 静态页面抓取(使用Fetch MCP或)、多源广泛研究(使用)、ffmpeg格式转换方案(使用),或违反平台服务条款的操作。
yt-dlpcurlresearchffmpegCanonical Vocabulary
标准术语表
| Term | Meaning | NOT |
|---|---|---|
| probe | Read-only metadata via | download |
| transcript | Captions/subtitles to text files; prefer over full download | audio rip by default |
| download | Persist media bytes after probe + user approval | silent bulk grab |
| playlist | Multi-entry URL; enumerate before selective download | blind full-playlist download |
| cookies | User-owned Netscape cookie file passed with | committed or skill-bundled secrets |
| doctor | Preflight JSON report for binary, version, ffmpeg | live URL smoke |
| format id | yt-dlp | guessed extension |
| manual sub | Creator-uploaded captions | auto-generated only |
| auto sub | Platform-generated captions | guaranteed accuracy |
| 术语 | 含义 | 不包含 |
|---|---|---|
| probe | 通过 | 下载 |
| transcript | 将字幕/副标题提取为文本文件;优先于完整下载 | 默认音频提取 |
| download | 完成探测并获得用户许可后,保存媒体文件 | 静默批量抓取 |
| playlist | 多条目URL;先枚举再选择性下载 | 盲目下载完整播放列表 |
| cookies | 用户自有Netscape格式Cookie文件,通过 | 已提交或技能内置的机密信息 |
| doctor | 针对二进制文件、版本、ffmpeg的预检JSON报告 | 实时URL测试 |
| format id | 探测得到的yt-dlp | 猜测的文件扩展名 |
| manual sub | 创作者上传的字幕 | 仅自动生成字幕 |
| auto sub | 平台生成的字幕 | 保证准确性 |
Dispatch
命令调度
| Mode | Action |
|---|---|---|
| Probe | Run bundled |
| Transcript | Probe first; extract best available subtitles without video download |
| Download | Probe first; confirm rights + format; download to explicit output dir |
| Playlist | Probe with playlist allowed; list entries; selective download only with approval |
| Cookies | Validate user-owned cookie file path; never copy into repo |
| Doctor | Run |
| Natural language: "what is this video", "get subtitles", "download this" | Auto | Map to probe → transcript → download per protocol below |
| (empty) | Help | Show modes, protocol, ethics pointer, and examples |
| 模式 | 操作 |
|---|---|---|
| Probe | 运行内置的 |
| Transcript | 先执行探测;无需下载视频即可提取最佳可用字幕 |
| Download | 先执行探测;确认权限和格式;下载至指定输出目录 |
| Playlist | 启用播放列表探测;列出条目;仅在获得许可后选择性下载 |
| Cookies | 验证用户自有Cookie文件路径;切勿复制到仓库中 |
| Doctor | 运行 |
| 自然语言指令:"这个视频是什么内容"、"获取字幕"、"下载这个" | 自动模式 | 根据下方协议映射为探测→转录→下载流程 |
| (空参数) | 帮助 | 显示模式说明、协议、伦理提示及示例 |
Auto-Detection Heuristic
自动检测规则
- URL + words like subtitle, caption, transcript, CC → Transcript (still probe first).
- URL + download, save, mp4, audio, rip → Download (still probe + approval first).
- URL + playlist, channel list, all videos → Playlist.
- Bare URL or "what is this link" → Probe.
- Path ending in or mention of login/auth → Cookies guidance, then re-probe with
cookies.txt.--cookies - Ambiguous → ask: metadata only, transcript, or download?
- URL + 包含subtitle、caption、transcript、CC等词汇 → Transcript(仍需先执行探测)。
- URL + 包含download、save、mp4、audio、rip等词汇 → Download(仍需先执行探测并获得许可)。
- URL + 包含playlist、channel list、all videos等词汇 → Playlist。
- 仅URL或询问"这个链接是什么" → Probe。
- 路径以结尾或提及login/auth → 提供Cookies指引,然后使用
cookies.txt参数重新探测。--cookies - 指令模糊 → 询问用户:仅需要元数据、转录文本,还是下载?
Transcript-First Protocol
先转录协议
Run these stages in order. Do not skip probe. Do not download until transcript needs are ruled out or the user explicitly wants media files.
按顺序执行以下步骤。不得跳过探测步骤。除非排除转录需求或用户明确要求媒体文件,否则不得下载。
Stage 1 — Doctor (once per session or after errors)
步骤1 — Doctor(每次会话或出错后执行一次)
bash
uv run python scripts/doctor.py --format jsonStop on or any check with (missing binary).
ok: falsestatus: failyt-dlpbash
uv run python scripts/doctor.py --format json如果返回或任何检查项(例如缺少二进制文件),则停止流程。
ok: falsestatus: failyt-dlpStage 2 — Probe (mandatory before transcript or download)
步骤2 — Probe(转录或下载前必须执行)
bash
uv run python scripts/probe_url.py --url 'https://…' --format jsonWith user-owned cookies:
bash
uv run python scripts/probe_url.py --url 'https://…' --cookies "$HOME/.config/yt-dlp/cookies.txt" --format jsonPlaylist URL (enumerate entries; pass on probe):
--allow-playlistbash
uv run python scripts/probe_url.py --url 'https://www.youtube.com/playlist?list=PL…' --allow-playlist --format jsonFrom probe JSON, report: , , , , , / languages, and recommended candidates. Load references/formats-and-quality.md when choosing formats.
idtitledurationuploaderavailabilitysubtitlesautomatic_captionsformat_idbash
uv run python scripts/probe_url.py --url 'https://…' --format json使用用户自有Cookie时:
bash
uv run python scripts/probe_url.py --url 'https://…' --cookies "$HOME/.config/yt-dlp/cookies.txt" --format json播放列表URL(枚举条目;探测时需传入):
--allow-playlistbash
uv run python scripts/probe_url.py --url 'https://www.youtube.com/playlist?list=PL…' --allow-playlist --format json从探测返回的JSON中,汇报:、、、、、/支持的语言,以及推荐的候选值。选择格式时可参考references/formats-and-quality.md。
idtitledurationuploaderavailabilitysubtitlesautomatic_captionsformat_idStage 3 — Transcript (preferred over download)
步骤3 — Transcript(优先于下载)
When subtitles exist, extract text without downloading video:
bash
yt-dlp --skip-download --write-subs --write-auto-subs --sub-langs 'en.*,en' \
--convert-subs srt --sub-format srt \
-o '%(title).200B.%(ext)s' \
--paths home:"$HOME/Downloads/yt-dlp/transcripts" \
'URL'Prefer manual subs over auto when both exist. Summarize path to / and offer to strip timing lines for plain text. If no subs: say so and ask before download-for-transcription (higher cost, rights-sensitive).
.srt.vtt当存在字幕时,无需下载视频即可提取文本:
bash
yt-dlp --skip-download --write-subs --write-auto-subs --sub-langs 'en.*,en' \
--convert-subs srt --sub-format srt \
-o '%(title).200B.%(ext)s' \
--paths home:"$HOME/Downloads/yt-dlp/transcripts" \
'URL'若同时存在manual字幕和auto字幕,优先选择manual字幕。汇总/文件路径,并提供移除时间轴以生成纯文本的选项。如果没有字幕:告知用户,并在下载以提取转录文本前确认(成本更高,涉及权限问题)。
.srt.vttStage 4 — Download (explicit approval required)
步骤4 — Download(需明确许可)
Before running:
- Confirm the user has rights to save the content (personal/archive/fair-use context per references/ethics-and-tos.md).
- Confirm output directory (default: ).
$HOME/Downloads/yt-dlp/media/ - Confirm format from probe (or sensible default:
-f FORMAT).bv*+ba/b
bash
mkdir -p "$HOME/Downloads/yt-dlp/media"
yt-dlp -f 'bv*+ba/b' \
--paths home:"$HOME/Downloads/yt-dlp/media" \
-o '%(playlist_index)s-%(title).200B.%(ext)s' \
'URL'Report output path, format id, file size, and whether ffmpeg merge ran.
执行前需确认:
- 用户拥有保存内容的权限(个人/存档/合理使用场景,参考references/ethics-and-tos.md)。
- 输出目录(默认:)。
$HOME/Downloads/yt-dlp/media/ - 从探测结果中确认格式(或合理默认值:
-f FORMAT)。bv*+ba/b
bash
mkdir -p "$HOME/Downloads/yt-dlp/media"
yt-dlp -f 'bv*+ba/b' \
--paths home:"$HOME/Downloads/yt-dlp/media" \
-o '%(playlist_index)s-%(title).200B.%(ext)s' \
'URL'汇报输出路径、格式ID、文件大小,以及是否执行了ffmpeg合并操作。
Mode Details
模式详情
Probe mode
Probe模式
- Use bundled (wraps
probe_url.py).yt-dlp --dump-json --no-download - Read-only: no writes under cwd or repo.
- For age-gated or login-only content, stop and route to Cookies — do not guess credentials.
- 使用内置的(封装
probe_url.py)。yt-dlp --dump-json --no-download - 只读模式:不在当前工作目录或仓库下写入文件。
- 对于年龄限制或需登录的内容,停止流程并引导至Cookies模式——切勿猜测凭据。
Transcript
Transcript模式
- Never default to downloading video/audio for text needs.
- Use always.
--skip-download - If multiple languages, pick user-requested lang or with fallback list from probe.
en
- 绝不默认下载视频/音频以满足文本需求。
- 始终使用参数。
--skip-download - 如果存在多种语言,选择用户指定的语言或探测结果中的及备选语言。
en
Download
Download模式
- Single URL default: unless user asked for playlist.
--no-playlist - No bulk channel/archival without explicit scope confirmation.
- Do not embed cookies in commands in chat logs; reference env or user path only.
$COOKIES
- 单URL默认:,除非用户明确要求播放列表。
--no-playlist - 未经明确范围确认,不得批量下载频道/存档内容。
- 切勿在聊天日志的命令中嵌入Cookie;仅引用环境变量或用户提供的路径。
$COOKIES
Playlist
Playlist模式
- Probe with playlist enabled:
bash
uv run python scripts/probe_url.py --url 'PLAYLIST_URL' --allow-playlist --format json- Present numbered entries (index, title, duration).
- Download selected indices only () after approval — never blind full playlist.
--playlist-items 1,3,5
- 启用播放列表探测:
bash
uv run python scripts/probe_url.py --url 'PLAYLIST_URL' --allow-playlist --format json- 展示带编号的条目(索引、标题、时长)。
- 获得许可后仅下载选定索引()——绝不盲目下载完整播放列表。
--playlist-items 1,3,5
Cookies
Cookies模式
- User-owned cookie file only — path under user home or explicit user-provided path.
- Never commit cookie files, never store in repo, never bundle in skill package.
- Export guidance (browser extension → Netscape ) lives in references/ethics-and-tos.md.
cookies.txt - Validate readability:
bash
test -r "$HOME/.config/yt-dlp/cookies.txt" && echo readablePass only on probe/download when user supplied the path.
--cookies PATH- 仅使用用户自有Cookie文件——路径位于用户主目录或用户明确提供的路径。
- 切勿提交Cookie文件、存储在仓库中或打包到技能包内。
- 导出指引(浏览器扩展→Netscape格式)见references/ethics-and-tos.md。
cookies.txt - 验证可读性:
bash
test -r "$HOME/.config/yt-dlp/cookies.txt" && echo readable仅当用户提供路径时,在探测/下载时传入参数。
--cookies PATHDoctor
Doctor模式
bash
uv run python scripts/doctor.py --format jsonParses JSON , , and per-check . Stop workflow on . Treat (e.g. missing ffmpeg) as advisory.
oksummarystatusfailwarnbash
uv run python scripts/doctor.py --format json解析JSON中的、及各检查项的。若出现则停止流程。将(例如缺少ffmpeg)视为提示信息。
oksummarystatusfailwarnHelp
帮助模式
Show dispatch table, transcript-first protocol, default paths, and ethics reference link.
展示命令调度表、先转录协议、默认路径及伦理参考链接。
Gallery (Empty Arguments)
示例库(空参数时展示)
Present common invocations when is empty:
$ARGUMENTS| # | Task | Example |
|---|---|---|
| 1 | Preflight | |
| 2 | Probe metadata | |
| 3 | Get subtitles | |
| 4 | Download (after approval) | |
| 5 | Playlist enumerate | |
| 6 | User-owned cookies | |
Pick a number, a mode from the dispatch table, or paste a URL and say whether you need metadata, subtitles, or a download.
当为空时,展示常用调用示例:
$ARGUMENTS| # | 任务 | 示例 |
|---|---|---|
| 1 | 预检 | |
| 2 | 探测元数据 | |
| 3 | 获取字幕 | |
| 4 | 下载(获得许可后) | |
| 5 | 枚举播放列表 | |
| 6 | 用户自有Cookie | |
选择编号、调度表中的模式,或粘贴URL并说明需要元数据、字幕还是下载。
Critical Rules
关键规则
- Probe before transcript or download — always use or equivalent
probe_url.py.--dump-json --no-download - Transcript before download — prefer subtitle extraction when captions exist.
--skip-download - Explicit approval for downloads — confirm rights, scope, output dir, and format.
- User-owned cookies only — never commit, copy into repo, or invent cookie paths.
- No ToS bypass coaching — see references/ethics-and-tos.md; refuse DRM circumvention or paywall evasion requests.
- Not Fetch MCP — static HTML, docs pages, and non-yt-dlp hosts → Fetch MCP or , not this skill.
curl - Not ffmpeg skill — remux, transcode, clip, waveform → after download if needed.
/ffmpeg - Least privilege output — write only under user-approved directories, never into the agents repo tree.
- Report provenance — title, URL, extractor, format id, and output paths in the final summary.
- 转录或下载前必须先探测——始终使用或等效的
probe_url.py命令。--dump-json --no-download - 下载前优先选择转录——若存在字幕,优先使用参数提取字幕。
--skip-download - 下载需明确许可——确认权限、范围、输出目录和格式。
- 仅使用用户自有Cookie——切勿提交、复制到仓库或伪造Cookie路径。
- 不指导违反服务条款的操作——参考references/ethics-and-tos.md;拒绝规避DRM或付费墙的请求。
- 替代Fetch MCP——静态HTML、文档页面和非yt-dlp支持的平台→使用Fetch MCP或,而非本技能。
curl - 替代ffmpeg技能——重封装、转码、剪辑、波形处理→下载后使用技能(若需要)。
/ffmpeg - 最小权限输出——仅写入用户许可的目录,切勿写入代理仓库目录。
- 汇报来源信息——最终汇总中需包含标题、URL、提取器、格式ID和输出路径。
Troubleshooting
故障排除
See references/troubleshooting.md for extractor errors, geo blocks, signature failures, and ffmpeg merge issues.
提取器错误、地域限制、签名失败和ffmpeg合并问题,请参考references/troubleshooting.md。
References
参考文档
| File | Use when |
|---|---|
| ethics-and-tos.md | Rights, cookies, refusal boundaries |
| formats-and-quality.md | Choosing |
| troubleshooting.md | Errors after doctor passes |
| 文件 | 使用场景 |
|---|---|
| ethics-and-tos.md | 权限、Cookie、拒绝边界 |
| formats-and-quality.md | 选择 |
| troubleshooting.md | Doctor检查通过后的错误处理 |
Scripts
脚本说明
| Script | Purpose |
|---|---|
| JSON preflight: yt-dlp, version, ffmpeg |
| Read-only |
| Validate skill manifest and evals |
| 脚本 | 用途 |
|---|---|
| JSON格式预检:检查yt-dlp、版本、ffmpeg |
| 只读 |
| 验证技能清单和评估项 |
Examples
示例
bash
undefinedbash
undefinedPreflight
预检
uv run python scripts/doctor.py --format json
uv run python scripts/doctor.py --format json
Probe
探测
uv run python scripts/probe_url.py --url 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' --format json
uv run python scripts/probe_url.py --url 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' --format json
Transcript (after probe shows subs)
提取转录文本(探测显示存在字幕时)
yt-dlp --skip-download --write-subs --write-auto-subs --sub-langs en -o '%(id)s'
--paths home:"$HOME/Downloads/yt-dlp/transcripts" 'URL'
--paths home:"$HOME/Downloads/yt-dlp/transcripts" 'URL'
yt-dlp --skip-download --write-subs --write-auto-subs --sub-langs en -o '%(id)s'
--paths home:"$HOME/Downloads/yt-dlp/transcripts" 'URL'
--paths home:"$HOME/Downloads/yt-dlp/transcripts" 'URL'
Download (after user approval)
下载(获得用户许可后)
yt-dlp -f 'bv*+ba/b' --paths home:"$HOME/Downloads/yt-dlp/media" -o '%(title).200B.%(ext)s' 'URL'
undefinedyt-dlp -f 'bv*+ba/b' --paths home:"$HOME/Downloads/yt-dlp/media" -o '%(title).200B.%(ext)s' 'URL'
undefined