/youtube-skills:youtube-subfrom youtube-skills
Get the subtitles / transcript of any YouTube video as clean text, timestamped text, an .srt subtitle file or JSON. Use whenever the user shares a YouTube link (watch, youtu.be, Shorts, live, embed, music) or video id and wants its subtitles, captions, transcript, an .srt file or an exact quote, and also whenever they ask to summarize the video, take notes on it, translate it or answer questions about it, because all of that starts from the transcript this skill fetches. Uses the video's own human-made subtitles when it has them. When it only has YouTube's auto-generated captions, Claude corrects the mis-heard words and punctuation itself. When the video has no captions at all, it transcribes the audio on this machine with Whisper. Also transcribes a local audio or video file (mp4, mp3, m4a, wav, webm) the user gives or uploads. Works in any language.
Ships in youtube-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
youtube-sub)Fetches a video's subtitles and saves them as a file. Human-made subtitles are used as they are. Auto-generated captions are corrected by you (section 2). A video with no captions at all has its audio transcribed locally (section 4).
In the commands below, SKILL_DIR means this skill's folder. Claude Code shows
it as "Base directory for this skill". On Claude.ai or in the desktop chat it is
usually /mnt/skills/user/youtube-sub. Use python instead of python3 on Windows.
python3 "SKILL_DIR/scripts/fetch_transcript.py" "<youtube url or id>" --out-dir "<dir>" [flags]
Pick <dir> like this:
--out <file> instead./mnt/user-data/outputs exists (Claude.ai / desktop chat sandbox): use it, so the user can download the file...Map the request to flags:
| The user wants | Flags |
|---|---|
| the transcript (default) | --format text: clean paragraphs with a Title/URL/Source header |
| timestamps | --format timestamped: one [mm:ss] line per ~30 s. Add --group-seconds 10 for finer lines |
subtitles / an .srt file | --format srt |
| structured data | --format json (segments with start/duration, plus the full text) |
| the subtitles in a given language ("English subtitles", "in Vietnamese") | --translate en. Uses a real en track when one exists, and YouTube's machine translation only when none does |
| to prefer a language but keep the original if it's missing | --lang en (comma-separated, best first: --lang vi,en) |
| which languages exist | --list-tracks (prints the tracks and exits) |
| the auto-captions exactly as YouTube made them | --raw |
| text only, no header | --no-header |
Without --lang or --translate, you get the language actually spoken in the video.
The first run takes about 10 seconds because the script creates its own Python
environment in ~/.cache/youtube-skills/venv. Do not pip-install anything yourself
unless the report says that step failed.
The script prints a JSON report. The fields that matter: ok, out, title,
duration, source_detail, words, needs_correction, parts_dir, parts,
speech_check, available_tracks, warnings, attempts and hints.
Where the text comes from, decided by the script:
needs_correction: true. Go to section 2.GEMINI_API_KEY is set. Already punctuated, so no correction.needs_correction: true, so section 2 applies.needs_correction: true)Auto-captions are an unpunctuated stream with mis-heard words. Correct them
before you hand over the file. Skip this section when the report has no
needs_correction, or when the user only wants a summary or an answer (section 6).
parts lists the files to correct: <parts_dir>/part-01.txt,
part-02.txt, … (about 8,000 characters each).words in the report): correcting rewrites every
word, so first give the user the raw file, say how many parts there are, and
ask whether to correct it. Otherwise just start.<parts_dir>/corrected/part-NN.txt
(same file name), following
references/correction-guide.md exactly. Use
the video title as context. With more than 3 parts and an Agent/Task tool
available, hand the parts to subagents (up to 4 at a time). Give each one the
guide's path, the title, the input path and the output path.python3 "SKILL_DIR/scripts/apply_corrections.py" --parts-dir "<parts_dir>" --out "<out>"
It rewrites <out> in place. A part that was paraphrased, summarized, drifted
into another language or lost a timestamp is rejected and keeps its original
caption text. For .srt files only the text changes, never the timing.accepted of parts. If kept_original lists a part, fix
that part once more and run the command again. Tell the user about any part
that still keeps the raw caption text.deletions_refused lists lines you emptied that the script put back, because
a voice is heard in that stretch of audio. Do not try to delete them again.
Real speech may be hidden under such a line, so tell the user its time range.Never remove speech on your own judgment. You cannot hear the audio. A line
that reads like an invented credit can sit on top of real dialogue. Removing a
line is only ever a proposal (an emptied marker line), and the script decides.
In a plain-text part, which has no markers, remove a line only when it is listed
in the fetch report's speech_check.no_voice_lines and is clearly not part of
the video.
[talk.en.srt](/full/path/talk.en.srt).warnings, in plain words, especially possible truncation.cues in the report) for SRT.--lang.
available_tracks lists what exists, and auto-generated tracks are marked (auto).translation_failed: true, YouTube refused the machine
translation (it rate-limits that endpoint hard) and the file holds the
original-language transcript. Say so, and offer to translate it yourself into
a new file, keeping the meaning exact and adding nothing.When the fetch fails with no_captions (or age_restricted), or the user gives
a local audio or video file, transcribe the audio on this machine. It needs no
API key and nothing is uploaded anywhere.
python3 "SKILL_DIR/scripts/fetch_transcript.py" "<youtube url>" --source whisper --out-dir "<dir>" [--format …]
python3 "SKILL_DIR/scripts/fetch_transcript.py" "<path to the audio or video file>" --out-dir "<dir>" [--format …]
.srt timing. Add --lang zh (or any code)
when the user told you the spoken language; otherwise it is detected.needs_correction: true.
Do section 2.speech_check in the report): it finds where
a voice is heard, transcribes suspicious stretches a second time, and removes
an invented line only where nothing else is there. If you still see an
invented line, propose its removal as section 2 describes. Never just drop it.blocked or fails with network (normal in the
Claude.ai / desktop chat sandbox, which cannot reach YouTube), ask the user to
download the video or its audio themselves and attach the file here, then run
the second command on that file. If GEMINI_API_KEY is set, the normal fetch
has already tried Gemini, which needs only the URL.ok: false)Read attempts and hints, then tell the user in one or two sentences what
failed and the concrete fix:
kind | Meaning | What to do |
|---|---|---|
no_captions | The video has no captions at all | Section 4: transcribe the audio |
blocked, network | YouTube blocks or cannot be reached from this machine (common on cloud, VPN and sandbox IPs) | Tell the user: set YT_PROXY_URL, or attach the video file (section 4). In the Claude desktop or web app, allow network access to youtube.com (Settings > Capabilities) |
unavailable | Private, deleted, or not a real video | Nothing can fetch it. Ask for another link |
age_restricted | YouTube serves this video to signed-in users only | Ask the user to attach the video file (section 4) |
missing_dep | A Python package could not be installed | Give the user the pip install command from the error text |
Never ask the user to paste an API key into the chat. Keys go in their shell
profile (export GEMINI_API_KEY=...), or in Claude Code's ~/.claude/settings.json
under "env".
There is no separate summary command. Once you have the transcript, do whatever the user asks with it.
--raw --out-dir "${TMPDIR:-/tmp}/youtube-sub" and skip
section 2. Read past mis-heard words using context instead of rewriting them.Run through this every time, after the last script has run. The scripts do the checking; your job is to read their reports and pass them on honestly.
speech_check (audio transcriptions only):
status: "pass": every stretch where a voice was detected has text, or
was checked a second time.status: "review": review lists time ranges where a voice was detected
but no words were recognized. The transcript may be missing speech there.
Give the user every range and say what it means. Do not call the
transcript complete.status: "not_run": the check could not run. Say that missing speech
would not have been noticed.recovered: speech the first pass skipped or hid under an invented line,
found on a second pass. Mention it with its time range.removed: invented lines that were taken out. List each with its time
range and text, so the user can object.apply_corrections.py report: status must be "pass". On "review",
report every kept_original part and every deletions_refused line.
removed_lines are lines you proposed removing and the script allowed:
list them too.watch?v=…&list=… link fetches
just that video. For a whole playlist, ask the user for the video links and
process them one by one.YOUGIST_BACKEND=off disables the hosted backend,
GEMINI_MODEL overrides the model (default gemini-2.5-flash),
WHISPER_MODEL picks the local speech model (small, medium, large-v3-turbo, large-v3), and
YT_PROXY_URL=http://user:pass@host:port routes YouTube requests through a proxy.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub enderphan94/youtube-skills --plugin youtube-skills