mk-youtube-get-caption
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseYouTube Caption Download
YouTube字幕下载
Download video subtitles and display content. Automatically detects video's original language and distinguishes between manual and auto-generated subtitles.
下载视频字幕并展示内容。自动检测视频的原始语言,区分人工上传字幕和自动生成字幕。
Quick Start
快速开始
/mk-youtube-get-caption <URL> [language|auto] [--force]/mk-youtube-get-caption <URL> [language|auto] [--force]Examples
示例
- - Auto-detect original language
/mk-youtube-get-caption https://youtube.com/watch?v=xxx - - Explicitly use original language
/mk-youtube-get-caption https://youtube.com/watch?v=xxx auto - - Download Japanese subtitles
/mk-youtube-get-caption https://youtube.com/watch?v=xxx ja - - Language priority list
/mk-youtube-get-caption https://youtube.com/watch?v=xxx "zh-TW,en"
- - 自动检测原始语言
/mk-youtube-get-caption https://youtube.com/watch?v=xxx - - 明确使用原始语言
/mk-youtube-get-caption https://youtube.com/watch?v=xxx auto - - 下载日语字幕
/mk-youtube-get-caption https://youtube.com/watch?v=xxx ja - - 语言优先级列表
/mk-youtube-get-caption https://youtube.com/watch?v=xxx \"zh-TW,en\"
Parameters
参数
| Parameter | Required | Default | Description |
|---|---|---|---|
| URL | Yes | - | YouTube video URL |
| language | No | auto | Language code or priority list |
| --force | No | false | Force re-download even if cached file exists |
| 参数 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|
| URL | 是 | - | YouTube视频URL |
| language | 否 | auto | 语言代码或优先级列表 |
| --force | 否 | false | 即使存在缓存文件,强制重新下载 |
Language Options
语言选项
| Value | Behavior |
|---|---|
| (empty) | Auto-detect video's original language |
| Same as empty |
| Specific language code |
| Comma-separated priority list |
| 值 | 行为 |
|---|---|
| (空值) | 自动检测视频的原始语言 |
| 与空值行为相同 |
| 指定语言代码 |
| 逗号分隔的优先级列表 |
How it Works
工作原理
- Execute:
{baseDir}/scripts/caption.sh "<URL>" "<language>" - If no language specified, detect video's original language
- Try to download manual (author-uploaded) subtitles first
- If unavailable, fall back to auto-generated subtitles
- Parse JSON output to get file path and metadata
- Use Read tool to get subtitle content if needed
- 执行:
{baseDir}/scripts/caption.sh \"<URL>\" \"<language>\" - 如果未指定语言,检测视频的原始语言
- 优先尝试下载人工上传(作者上传)的字幕
- 如果人工字幕不可用,回退到自动生成的字幕
- 解析JSON输出以获取文件路径和元数据
- 如需获取字幕内容,使用Read工具读取
Output Format
输出格式
Success:
json
{
"status": "success",
"file_path": "{baseDir}/data/20091025__VIDEO_ID.en.srt",
"text_file_path": "{baseDir}/data/20091025__VIDEO_ID.en.txt",
"language": "en",
"subtitle_type": "manual",
"char_count": 30287,
"line_count": 1555,
"text_char_count": 25000,
"text_line_count": 800,
"cached": false,
"video_id": "dQw4w9WgXcQ",
"title": "Video Title",
"channel": "Channel Name",
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}Cache hit (returns existing file):
json
{
"status": "success",
"file_path": "{baseDir}/data/20091025__VIDEO_ID.en.srt",
"subtitle_type": "cached",
"cached": true,
...
}Error:
json
{
"status": "error",
"message": "No subtitles found (this video may not have subtitles)"
}成功时:
json
{
\"status\": \"success\",
\"file_path\": \"{baseDir}/data/20091025__VIDEO_ID.en.srt\",
\"text_file_path\": \"{baseDir}/data/20091025__VIDEO_ID.en.txt\",
\"language\": \"en\",
\"subtitle_type\": \"manual\",
\"char_count\": 30287,
\"line_count\": 1555,
\"text_char_count\": 25000,
\"text_line_count\": 800,
\"cached\": false,
\"video_id\": \"dQw4w9WgXcQ\",
\"title\": \"Video Title\",
\"channel\": \"Channel Name\",
\"url\": \"https://www.youtube.com/watch?v=dQw4w9WgXcQ\"
}命中缓存(返回已存在的文件):
json
{
\"status\": \"success\",
\"file_path\": \"{baseDir}/data/20091025__VIDEO_ID.en.srt\",
\"subtitle_type\": \"cached\",
\"cached\": true,
...
}错误时:
json
{
\"status\": \"error\",
\"message\": \"No subtitles found (this video may not have subtitles)\"
}Output Fields
输出字段
| Field | Description |
|---|---|
| Absolute path to the downloaded SRT file |
| Absolute path to plain text file (no timestamps) |
| Detected language code of the downloaded subtitle |
| |
| Number of characters in the SRT file |
| Number of lines in the SRT file |
| Number of characters in the plain text file |
| Number of lines in the plain text file |
| YouTube video ID |
| Video title |
| Channel name |
| Full video URL |
| 字段 | 说明 |
|---|---|
| 下载的SRT文件的绝对路径 |
| 纯文本文件的绝对路径(无时间戳) |
| 下载字幕的检测语言代码 |
| |
| SRT文件中的字符数 |
| SRT文件中的行数 |
| 纯文本文件中的字符数 |
| 纯文本文件中的行数 |
| YouTube视频ID |
| 视频标题 |
| 频道名称 |
| 完整视频URL |
Filename Format
文件名格式
Files use unified naming with date prefix:
{YYYYMMDD}__{video_id}.{lang}.{ext}Example:
20091025__dQw4w9WgXcQ.en.srt文件采用统一命名格式,带有日期前缀:
{YYYYMMDD}__{video_id}.{lang}.{ext}示例:
20091025__dQw4w9WgXcQ.en.srtNotes
注意事项
- File caching: If caption file already exists for this video/language, it will be reused (returns )
cached: true - Force refresh: Use flag to re-download even if cached file exists
--force - Uses system yt-dlp/jq if available, otherwise auto-downloads on first run
- Some videos may not have subtitles
- Manual subtitles are prioritized over auto-generated ones
- Auto-generated subtitles may be less accurate
- 文件缓存:如果该视频/语言的字幕文件已存在,将直接复用(返回)
cached: true - 强制刷新:使用参数可忽略缓存文件,强制重新下载
--force - 如果系统中存在yt-dlp/jq则直接使用,否则首次运行时会自动下载
- 部分视频可能没有字幕
- 优先使用人工上传的字幕,而非自动生成字幕
- 自动生成的字幕可能准确性较低
Next Step
下一步操作
After downloading the caption, invoke with the from the output to generate a structured summary:
/mk-youtube-transcript-summarizetext_file_path/mk-youtube-transcript-summarize <text_file_path>IMPORTANT: Always use the Skill tool to invoke . Do NOT generate summaries directly without loading the skill — it contains critical rules for compression ratio, section structure, data preservation, and language handling.
/mk-youtube-transcript-summarize下载字幕完成后,可调用工具并传入输出中的以生成结构化摘要:
/mk-youtube-transcript-summarizetext_file_path/mk-youtube-transcript-summarize <text_file_path>重要提示:请务必通过Skill工具调用。请勿直接生成摘要而不加载该Skill——它包含了压缩比例、章节结构、数据保留和语言处理的关键规则。
/mk-youtube-transcript-summarize