YouTube 字幕提取技能 从 YouTube 视频提取字幕,输出中文文字稿。 快速使用 工作流程 1. 获取视频链接 :从用户消息中提取 YouTube URL 2. 运行脚本 :执行 提取字幕 3. 处理输出 : - 如果字幕是中文:直接输出 - 如果字幕是英文:翻译为中文后输出 4. 保存结果 :根据用户需求保存为 Markdown 文件 脚本参数 | 参数 | 说明 | 默认值 | |-----|------|-------| | | YouTube 视频链接或 ID | 必填 | | | 输出格式: , , | | | | 包含时间戳 | 否 | | | 首选语言(逗号分隔) | | | | 输出文件路径 | stdout | 使用示例 基本用法 带时间戳输出 保存到文件 JSON 格式(便于后处理) 支持的 URL 格式 - - - - 直接使用 Video ID 语言优先级 脚本按以下顺序查找字幕: 1. 简体中文 (zh-Hans) 2. 繁体中文 (zh-Hant) 3. 中文 (zh) 4. 英文 (en) 5. 自动生成字幕 翻译处理 如果获取到的是英文字幕,需要翻译为中文: 1. 运行脚本获取英文字幕 2. 使用 Claude 内置能力翻译为流畅的中文 3. 保持原文结构和段落划分 错误处理 | 错误 | 原因 | 解决方案 | |-----|-----…

\n ]\n for pattern in patterns:\n match = re.search(pattern, url)\n if match:\n return match.group(1)\n raise ValueError(f\"Cannot extract video ID from: {url}\")\n\ndef format_timestamp(seconds: float) -> str:\n \"\"\"Convert seconds to HH:MM:SS format.\"\"\"\n hours = int(seconds // 3600)\n minutes = int((seconds % 3600) // 60)\n secs = int(seconds % 60)\n if hours > 0:\n return f\"{hours:02d}:{minutes:02d}:{secs:02d}\"\n return f\"{minutes:02d}:{secs:02d}\"\n\ndef get_transcript(video_id: str, lang_priority: list = None):\n \"\"\"Fetch transcript using youtube-transcript-api.\"\"\"\n YouTubeTranscriptApi = ensure_dependency()\n\n if lang_priority is None:\n lang_priority = ['zh-Hans', 'zh-Hant', 'zh', 'zh-CN', 'zh-TW', 'en', 'en-US', 'en-GB']\n\n try:\n # Create API instance\n ytt_api = YouTubeTranscriptApi()\n\n # List available transcripts\n transcript_list = ytt_api.list(video_id)\n\n # Try to find transcript in preferred language order\n transcript = None\n used_lang = None\n is_generated = False\n\n # First try manual transcripts\n for lang in lang_priority:\n try:\n transcript = transcript_list.find_transcript([lang])\n used_lang = lang\n is_generated = transcript.is_generated\n break\n except:\n continue\n\n # Then try auto-generated\n if not transcript:\n for lang in lang_priority:\n try:\n transcript = transcript_list.find_generated_transcript([lang])\n used_lang = lang\n is_generated = True\n break\n except:\n continue\n\n # Fallback to any available\n if not transcript:\n try:\n for t in transcript_list:\n transcript = t\n used_lang = t.language_code\n is_generated = t.is_generated\n break\n except:\n pass\n\n if not transcript:\n return {\"error\": \"No transcript available\", \"segments\": [], \"language\": None}\n\n segments = transcript.fetch()\n # Convert FetchedTranscript to list of dicts\n segment_list = [{\"start\": s.start, \"duration\": s.duration, \"text\": s.text} for s in segments]\n\n return {\n \"segments\": segment_list,\n \"language\": used_lang,\n \"is_generated\": is_generated\n }\n except Exception as e:\n return {\"error\": str(e), \"segments\": [], \"language\": None}\n\ndef format_output(video_id: str, transcript_data: dict, output_format: str = \"markdown\",\n include_timestamps: bool = False) -> str:\n \"\"\"Format the transcript output.\"\"\"\n segments = transcript_data.get(\"segments\", [])\n error = transcript_data.get(\"error\")\n\n lines = []\n\n if output_format == \"markdown\":\n lines.append(f\"# YouTube 视频文字稿\")\n lines.append(\"\")\n lines.append(f\"- **Video ID**: `{video_id}`\")\n lines.append(f\"- **链接**: https://www.youtube.com/watch?v={video_id}\")\n if transcript_data.get(\"language\"):\n lines.append(f\"- **语言**: {transcript_data['language']}\")\n if transcript_data.get(\"is_generated\"):\n lines.append(\"- **字幕类型**: 自动生成\")\n lines.append(\"\")\n lines.append(\"---\")\n lines.append(\"\")\n\n if error:\n lines.append(f\"❌ 错误: {error}\")\n return \"\\n\".join(lines)\n\n if not segments:\n lines.append(\"❌ 没有找到字幕内容\")\n return \"\\n\".join(lines)\n\n if output_format == \"markdown\":\n lines.append(\"## 文字稿\")\n lines.append(\"\")\n\n if include_timestamps:\n for seg in segments:\n ts = format_timestamp(seg.get(\"start\", 0))\n text = seg.get(\"text\", \"\").strip()\n lines.append(f\"**[{ts}]** {text}\")\n lines.append(\"\")\n else:\n # Merge into paragraphs\n current_paragraph = []\n paragraph_start = 0\n\n for i, seg in enumerate(segments):\n text = seg.get(\"text\", \"\").strip()\n start = seg.get(\"start\", 0)\n\n # New paragraph every ~60 seconds or on long pause\n if current_paragraph:\n if start - paragraph_start > 60:\n lines.append(\" \".join(current_paragraph))\n lines.append(\"\")\n current_paragraph = []\n paragraph_start = start\n else:\n paragraph_start = start\n\n if text:\n current_paragraph.append(text)\n\n if current_paragraph:\n lines.append(\" \".join(current_paragraph))\n\n return \"\\n\".join(lines)\n\ndef main():\n parser = argparse.ArgumentParser(description=\"Extract YouTube video transcripts\")\n parser.add_argument(\"url\", help=\"YouTube video URL or video ID\")\n parser.add_argument(\"-f\", \"--format\", choices=[\"text\", \"markdown\", \"json\"],\n default=\"markdown\", help=\"Output format (default: markdown)\")\n parser.add_argument(\"-t\", \"--timestamps\", action=\"store_true\",\n help=\"Include timestamps in output\")\n parser.add_argument(\"-l\", \"--lang\", default=\"zh,en\",\n help=\"Preferred languages, comma-separated (default: zh,en)\")\n parser.add_argument(\"-o\", \"--output\", help=\"Output file path (default: stdout)\")\n\n args = parser.parse_args()\n\n try:\n video_id = extract_video_id(args.url)\n except ValueError as e:\n print(f\"Error: {e}\", file=sys.stderr)\n sys.exit(1)\n\n # Parse language preference\n lang_priority = []\n for lang in args.lang.split(\",\"):\n lang = lang.strip()\n if lang == \"zh\":\n lang_priority.extend(['zh-Hans', 'zh-Hant', 'zh', 'zh-CN', 'zh-TW'])\n elif lang == \"en\":\n lang_priority.extend(['en', 'en-US', 'en-GB'])\n else:\n lang_priority.append(lang)\n\n # Get transcript\n transcript_data = get_transcript(video_id, lang_priority)\n\n # Format output\n if args.format == \"json\":\n output = json.dumps({\n \"video_id\": video_id,\n \"url\": f\"https://www.youtube.com/watch?v={video_id}\",\n \"transcript\": transcript_data\n }, ensure_ascii=False, indent=2)\n else:\n output = format_output(video_id, transcript_data, args.format, args.timestamps)\n\n # Write output\n if args.output:\n with open(args.output, \"w\", encoding=\"utf-8\") as f:\n f.write(output)\n print(f\"✅ Saved to: {args.output}\", file=sys.stderr)\n else:\n print(output)\n\nif __name__ == \"__main__\":\n main()\n","content_type":"text/x-python; charset=utf-8","language":"python","size":7775,"content_sha256":"9b5634d0a0ea90e196a643d3a1172bf70b400437f21c553ae208600883fdf650"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"YouTube 字幕提取技能","type":"text"}]},{"type":"paragraph","content":[{"text":"从 YouTube 视频提取字幕,输出中文文字稿。","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"快速使用","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"python3 scripts/get_transcript.py \"https://www.youtube.com/watch?v=VIDEO_ID\"","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"工作流程","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"获取视频链接","type":"text","marks":[{"type":"strong"}]},{"text":":从用户消息中提取 YouTube URL","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"运行脚本","type":"text","marks":[{"type":"strong"}]},{"text":":执行 ","type":"text"},{"text":"scripts/get_transcript.py","type":"text","marks":[{"type":"code_inline"}]},{"text":" 提取字幕","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"处理输出","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"如果字幕是中文:直接输出","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"如果字幕是英文:翻译为中文后输出","type":"text"}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"保存结果","type":"text","marks":[{"type":"strong"}]},{"text":":根据用户需求保存为 Markdown 文件","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"脚本参数","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"参数","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"说明","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"默认值","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"url","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"YouTube 视频链接或 ID","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"必填","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"-f, --format","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"输出格式: ","type":"text"},{"text":"text","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"markdown","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"json","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"markdown","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"-t, --timestamps","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"包含时间戳","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"否","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"-l, --lang","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"首选语言(逗号分隔)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"zh,en","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"-o, --output","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"输出文件路径","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"stdout","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"使用示例","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"基本用法","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"python3 scripts/get_transcript.py \"https://www.youtube.com/watch?v=dQw4w9WgXcQ\"","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"带时间戳输出","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"python3 scripts/get_transcript.py -t \"https://youtu.be/VIDEO_ID\"","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"保存到文件","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"python3 scripts/get_transcript.py -o output.md \"https://www.youtube.com/watch?v=VIDEO_ID\"","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"JSON 格式(便于后处理)","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"python3 scripts/get_transcript.py -f json \"VIDEO_ID\"","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"支持的 URL 格式","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"https://www.youtube.com/watch?v=VIDEO_ID","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"https://youtu.be/VIDEO_ID","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"https://www.youtube.com/embed/VIDEO_ID","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"直接使用 Video ID","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"语言优先级","type":"text"}]},{"type":"paragraph","content":[{"text":"脚本按以下顺序查找字幕:","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"简体中文 (zh-Hans)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"繁体中文 (zh-Hant)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"中文 (zh)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"英文 (en)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"自动生成字幕","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"翻译处理","type":"text"}]},{"type":"paragraph","content":[{"text":"如果获取到的是英文字幕,需要翻译为中文:","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"运行脚本获取英文字幕","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"使用 Claude 内置能力翻译为流畅的中文","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"保持原文结构和段落划分","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"错误处理","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"错误","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"原因","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"解决方案","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"No captions available","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"视频无字幕","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"告知用户该视频没有可用字幕","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Cannot extract video ID","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"URL 格式错误","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"请求用户提供正确的 YouTube 链接","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"网络超时","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"网络问题","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"重试或检查网络连接","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"输出格式示例","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Markdown 格式","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"markdown"},"content":[{"text":"# 视频标题\n\n- **Video ID**: abc123\n- **语言**: 中文(自动生成)\n- **链接**: https://www.youtube.com/watch?v=abc123\n\n---\n\n## 文字稿\n\n这是视频的第一段内容...\n\n这是视频的第二段内容...","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}}]},"metadata":{"date":"2026-06-05","name":"youtube-transcript-cn","author":"@skillopedia","source":{"stars":310,"repo_name":"myskill","origin_url":"https://github.com/zephyrwang6/myskill/blob/HEAD/youtube-transcript-cn/SKILL.md","repo_owner":"zephyrwang6","body_sha256":"98f45d1bbe9ac76f8e6eaf2c6a8b442447611e987b436f6bffa754c17e95f4d8","cluster_key":"63d55ea4b3fea4ca67bc36b0c2276de2f1989e528c24367ac35fee665714651d","clean_bundle":{"format":"clean-skill-bundle-v1","source":"zephyrwang6/myskill/youtube-transcript-cn/SKILL.md","attachments":[{"id":"74c29a0d-5c00-522a-b668-15c997e31555","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/74c29a0d-5c00-522a-b668-15c997e31555/attachment.py","path":"scripts/get_transcript.py","size":7775,"sha256":"9b5634d0a0ea90e196a643d3a1172bf70b400437f21c553ae208600883fdf650","contentType":"text/x-python; charset=utf-8"},{"id":"03603068-c6b8-5d55-a5fe-408675112b5a","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/03603068-c6b8-5d55-a5fe-408675112b5a/attachment.skill","path":"youtube-transcript-cn.skill","size":4346,"sha256":"05964c479b954be3ceefed095c15cce45b8eaa75055e2fba20feaa644f7651ba","contentType":"application/octet-stream"}],"bundle_sha256":"191bc8430e6261f7040e2adc78a8795b175e477a2b4e27c17e32e5d0be99fce6","attachment_count":2,"text_attachments":1,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":1,"excluded_attachments":[]},"cluster_size":1,"skill_md_path":"youtube-transcript-cn/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"general","category_label":"General"},"exact_dupes_collapsed_into_this":0},"version":"v1","category":"general","import_tag":"clean-skills-v1","description":"从 YouTube 视频链接提取字幕并转换为中文文字稿。支持自动生成字幕和手动字幕。\n使用场景:(1) 用户提供 YouTube 链接并要求提取字幕/文字稿,(2) 用户要求将 YouTube 视频内容转为文字,\n(3) 用户说\"帮我把这个 YouTube 视频转成文字\"或类似请求。\n触发词:YouTube 字幕、视频转文字、提取字幕、YouTube transcript、视频文字稿。\n"}},"renderedAt":1782980300274}

YouTube 字幕提取技能 从 YouTube 视频提取字幕,输出中文文字稿。 快速使用 工作流程 1. 获取视频链接 :从用户消息中提取 YouTube URL 2. 运行脚本 :执行 提取字幕 3. 处理输出 : - 如果字幕是中文:直接输出 - 如果字幕是英文:翻译为中文后输出 4. 保存结果 :根据用户需求保存为 Markdown 文件 脚本参数 | 参数 | 说明 | 默认值 | |-----|------|-------| | | YouTube 视频链接或 ID | 必填 | | | 输出格式: , , | | | | 包含时间戳 | 否 | | | 首选语言(逗号分隔) | | | | 输出文件路径 | stdout | 使用示例 基本用法 带时间戳输出 保存到文件 JSON 格式(便于后处理) 支持的 URL 格式 - - - - 直接使用 Video ID 语言优先级 脚本按以下顺序查找字幕: 1. 简体中文 (zh-Hans) 2. 繁体中文 (zh-Hant) 3. 中文 (zh) 4. 英文 (en) 5. 自动生成字幕 翻译处理 如果获取到的是英文字幕,需要翻译为中文: 1. 运行脚本获取英文字幕 2. 使用 Claude 内置能力翻译为流畅的中文 3. 保持原文结构和段落划分 错误处理 | 错误 | 原因 | 解决方案 | |-----|-----…