mk-youtube-get-caption

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

YouTube 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

示例

  • /mk-youtube-get-caption https://youtube.com/watch?v=xxx
    - Auto-detect original language
  • /mk-youtube-get-caption https://youtube.com/watch?v=xxx auto
    - Explicitly use original language
  • /mk-youtube-get-caption https://youtube.com/watch?v=xxx ja
    - Download Japanese subtitles
  • /mk-youtube-get-caption https://youtube.com/watch?v=xxx "zh-TW,en"
    - Language priority list
  • /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

参数

ParameterRequiredDefaultDescription
URLYes-YouTube video URL
languageNoautoLanguage code or priority list
--forceNofalseForce re-download even if cached file exists
参数是否必填默认值说明
URL-YouTube视频URL
languageauto语言代码或优先级列表
--forcefalse即使存在缓存文件,强制重新下载

Language Options

语言选项

ValueBehavior
(empty)Auto-detect video's original language
auto
Same as empty
en
,
ja
, etc.
Specific language code
"en,ja,zh-TW"
Comma-separated priority list
行为
(空值)自动检测视频的原始语言
auto
与空值行为相同
en
,
ja
指定语言代码
\"en,ja,zh-TW\"
逗号分隔的优先级列表

How it Works

工作原理

  1. Execute:
    {baseDir}/scripts/caption.sh "<URL>" "<language>"
  2. If no language specified, detect video's original language
  3. Try to download manual (author-uploaded) subtitles first
  4. If unavailable, fall back to auto-generated subtitles
  5. Parse JSON output to get file path and metadata
  6. Use Read tool to get subtitle content if needed
  1. 执行:
    {baseDir}/scripts/caption.sh \"<URL>\" \"<language>\"
  2. 如果未指定语言,检测视频的原始语言
  3. 优先尝试下载人工上传(作者上传)的字幕
  4. 如果人工字幕不可用,回退到自动生成的字幕
  5. 解析JSON输出以获取文件路径和元数据
  6. 如需获取字幕内容,使用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

输出字段

FieldDescription
file_path
Absolute path to the downloaded SRT file
text_file_path
Absolute path to plain text file (no timestamps)
language
Detected language code of the downloaded subtitle
subtitle_type
manual
(author-uploaded) or
auto-generated
(YouTube AI)
char_count
Number of characters in the SRT file
line_count
Number of lines in the SRT file
text_char_count
Number of characters in the plain text file
text_line_count
Number of lines in the plain text file
video_id
YouTube video ID
title
Video title
channel
Channel name
url
Full video URL
字段说明
file_path
下载的SRT文件的绝对路径
text_file_path
纯文本文件的绝对路径(无时间戳)
language
下载字幕的检测语言代码
subtitle_type
manual
(作者上传)或
auto-generated
(YouTube AI生成)
char_count
SRT文件中的字符数
line_count
SRT文件中的行数
text_char_count
纯文本文件中的字符数
text_line_count
纯文本文件中的行数
video_id
YouTube视频ID
title
视频标题
channel
频道名称
url
完整视频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.srt

Notes

注意事项

  • File caching: If caption file already exists for this video/language, it will be reused (returns
    cached: true
    )
  • Force refresh: Use
    --force
    flag to re-download even if cached file exists
  • 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
/mk-youtube-transcript-summarize
with the
text_file_path
from the output to generate a structured summary:
/mk-youtube-transcript-summarize <text_file_path>
IMPORTANT: Always use the Skill tool to invoke
/mk-youtube-transcript-summarize
. 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
工具并传入输出中的
text_file_path
以生成结构化摘要:
/mk-youtube-transcript-summarize <text_file_path>
重要提示:请务必通过Skill工具调用
/mk-youtube-transcript-summarize
。请勿直接生成摘要而不加载该Skill——它包含了压缩比例、章节结构、数据保留和语言处理的关键规则。