AgentSkillsCN

youtube-get-transcript

下载YouTube视频字幕。当用户想要从视频中获取转录文本或字幕时使用此功能。

SKILL.md
--- frontmatter
name: youtube-get-transcript
description: Download YouTube video subtitles. Use when user wants to get transcript or captions from a video.
license: MIT
metadata:
  version: 1.1.0
  author: kouko
  tags:
    - youtube
    - transcript
    - subtitle
compatibility:
  claude-code: ">=1.0.0"

YouTube Transcript Download

Download video subtitles and display content. Automatically detects video's original language and distinguishes between manual and auto-generated subtitles.

Quick Start

code
/youtube-get-transcript <URL> [language|auto]

Examples

  • /youtube-get-transcript https://youtube.com/watch?v=xxx - Auto-detect original language
  • /youtube-get-transcript https://youtube.com/watch?v=xxx auto - Explicitly use original language
  • /youtube-get-transcript https://youtube.com/watch?v=xxx ja - Download Japanese subtitles
  • /youtube-get-transcript https://youtube.com/watch?v=xxx "zh-TW,en" - Language priority list

Language Options

ValueBehavior
(empty)Auto-detect video's original language
autoSame as empty
en, ja, etc.Specific language code
"en,ja,zh-TW"Comma-separated priority list

How it Works

  1. Execute: {baseDir}/scripts/transcript.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

Output Format

Success:

json
{
  "status": "success",
  "file_path": "/tmp/youtube-get-transcripts/VIDEO_ID.en.srt",
  "text_file_path": "/tmp/youtube-get-transcripts/VIDEO_ID.en.txt",
  "language": "en",
  "subtitle_type": "manual",
  "char_count": 30287,
  "line_count": 1555,
  "text_char_count": 25000,
  "text_line_count": 800
}

Error:

json
{
  "status": "error",
  "message": "No subtitles found (this video may not have subtitles)"
}

Output Fields

FieldDescription
file_pathAbsolute path to the downloaded SRT file
text_file_pathAbsolute path to plain text file (no timestamps)
languageDetected language code of the downloaded subtitle
subtitle_typemanual (author-uploaded) or auto-generated (YouTube AI)
char_countNumber of characters in the SRT file
line_countNumber of lines in the SRT file
text_char_countNumber of characters in the plain text file
text_line_countNumber of lines in the plain text file

Notes

  • On first run, if yt-dlp or jq is not installed, it will be auto-downloaded
  • Some videos may not have subtitles
  • Manual subtitles are prioritized over auto-generated ones
  • Auto-generated subtitles may be less accurate