agentleFS
abhaylaabhayla/claude-best-practices/.claude/skills/youtube-transcript/SKILL.md

youtube-transcript

Skill9 starsChanged 7 months agoMITView on GitHub

Extract the full transcript (and optional metadata) of ANY YouTube video — short, long, or Shorts — given just its link. Tries clean captions first, falls back to yt-dlp subtitle download, and finally to audio + Whisper speech-to-text when a video has NO captions at all. Use whenever the user pastes a YouTube URL and wants the spoken content as text, or asks to summarize / analyze / search a video.

  • Installs packages

59 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use research-prompt, ship-learn-next and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • matyasstochSkill

    research-prompt

    Write a single-paragraph Deep Research prompt to hand to a human researcher (or a deep-research AI). Use when the user wants a research brief, a "deep research prompt", a one-paragraph task for a researcher, or asks "what should our researcher look for". Produces ONE tight paragraph with full context, numbered sub-questions, and per-finding output format.

    Also in 3 projects that use this

  • michalparkolaSkill

    ship-learn-next

    Transform learning content (like YouTube transcripts, articles, tutorials) into actionable implementation plans using the Ship-Learn-Next framework. Use when user wants to turn advice, lessons, or educational content into concrete action steps, reps, or a learning quest.

    Also in 4 projects that use this

  • huskerjeffSkill

    youtube-search

    Search YouTube and extract video metadata and captions using yt-dlp. Use when the user wants to search YouTube, find video transcripts, research topics via YouTube, or feed video content into other tools like NotebookLM.

    Also in 4 projects that use this

  • michalparkolaSkill

    article-extractor

    Extract clean article content from URLs (blog posts, articles, tutorials) and save as readable text. Use when user wants to download, extract, or save an article/blog post from a URL without ads, navigation, or clutter.

    Also in 3 projects that use this

  • MicrosoftSkill

    web-search

    Also in 3 projects that use this

  • ArogyaReddySkill

    changelog-generator

    Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 50 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Prefer --json when scripting: parse transcript and report the method used.

    line 71
  2. Very specific:

    If transcript is null, read attempts to see why each layer failed (e.g.

    line 81
  3. Distinctive:

    Write the file if requested (STEP 1 path), then report: the method that won, word/char count, and the saved path.

    line 86
  4. Distinctive:

    All three layers exercised independently and end-to-end.

    line 111

“Common” is measured: kept by at least 6 in 10 of the 50 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

YouTube Transcript Extractor

Give it a YouTube link → get the full spoken text back. Handles any length and any URL form (watch?v=, youtu.be/, /shorts/, /live/, or a bare 11-char id). The worker is yt_transcript.py in this skill directory; the steps below drive it.

Prerequisites

  • Tools/CLIs: Python 3.x; yt-dlp + youtube-transcript-api (layers 1–2); faster-whisper
    • ffmpeg on PATH (layer 3, ASR fallback only — not needed when captions exist)
  • Files: yt_transcript.py (ships in this skill directory)
  • Services/network: reachable youtube.com, ideally from a non-cloud/residential IP — YouTube blocks known cloud-provider IPs for caption endpoints (see Gotchas)
  • User inputs & decisions: the YouTube URL; optional --out path, --meta, --lang, --force-asr/--asr-model — collect these up front
  • Declared fallback: the 3-layer chain — youtube-transcript-api → yt-dlp subtitles → yt-dlp audio + faster-whisper ASR — legal, no mid-run user input needed

STEP 0: Preflight

python -c "import yt_dlp, youtube_transcript_api" 2>&1   # layers 1-2, required
python -c "import faster_whisper" 2>&1                    # layer 3, optional
ffmpeg -version >/dev/null 2>&1 && echo ffmpeg-ok || echo ffmpeg-missing   # layer 3, optional

Collect the URL and output preferences (STEP 1 below) while the user is present. If BOTH yt_dlp and youtube_transcript_api are missing, report that in one line and HARD-STOP (pip install yt-dlp youtube-transcript-api) — no layer could run. If only faster_whisper/ ffmpeg are missing, warn once and continue — the ASR layer degrades gracefully rather than blocking layers 1–2.

STEP 1: Resolve the link and pick the output

Take the YouTube URL (or id) from the user. Decide where the text should go:

  • to the chat → run plain (stdout),
  • to a file → pass --out <file>. Save transcripts with a .md extension (Markdown — reads cleanly in editors and previews, and is the project default). If the user asks for "filename = video name", first read the title (--meta --json), strip Windows-illegal characters <>:"/\|?*, and append .md.
  • Save transcript files OUTSIDE the project's git tree (e.g. a sibling transcripts/ folder) so deliverables don't pollute the repo.

STEP 2: Run the extractor

# clean text to stdout
python .claude/skills/youtube-transcript/yt_transcript.py "<URL>"

# save to a file (use a .md extension), include title/channel/duration
python .claude/skills/youtube-transcript/yt_transcript.py "<URL>" --meta --out transcript.md

# machine-readable: transcript + which method won + per-layer attempts
python .claude/skills/youtube-transcript/yt_transcript.py "<URL>" --json

Flags: --lang en (preferred caption language) · --out FILE · --json · --meta · --force-asr (skip captions, transcribe audio directly) · --asr-model tiny|base|small|medium|large-v3.

STEP 3: Read the result and let the fallback chain work

Prefer --json when scripting: parse transcript and report the method used. The tool tries three layers automatically, first that yields text wins:

  1. youtube-transcript-api — fast, clean text; manual or auto captions. Primary.
  2. yt-dlp subtitles — downloads the VTT track and de-duplicates it; succeeds on some tracks where layer 1 hits YouTube's PoToken block, with no extra services.
  3. yt-dlp audio + faster-whisper (ASR) — only when a video has no captions at all. Downloads audio, runs local speech-to-text. This is the "do whatever it takes" layer that off-the-shelf YouTube-transcript MCP servers do not have.

If transcript is null, read attempts to see why each layer failed (e.g. blocked, no subs, ASR package missing).

STEP 4: Save and report

Write the file if requested (STEP 1 path), then report: the method that won, word/char count, and the saved path. If you produced a deliverable file for the user, surface it.

Setup (one-time)

pip install yt-dlp youtube-transcript-api   # layers 1 & 2
pip install faster-whisper                  # layer 3 (ASR); needs ffmpeg on PATH

Verified with: yt-dlp 2026.6.9, youtube-transcript-api 1.2.4, faster-whisper 1.2.1, ffmpeg 8.1, Python 3.13. Output is forced to UTF-8 so non-English transcripts are not corrupted on Windows (cp1252).

Verified test results

VideoLengthMethod that wonOutput
Me at the zoo (jNQXAC9IVRw)19 syoutube-transcript-api39 words
Mind Field Ep1 (/shorts/ URL)35 minyoutube-transcript-api4,072 words
Intro to LLMs (zjkBMFhNj_g)60 minyoutube-transcript-api12,151 words
Karpathy "build GPT" (kCc8FmEb1nY)116 minyoutube-transcript-api21,030 words
3Blue1Brown neural nets (aircAruvnKk)19 minyt-dlp subtitles (standalone)3,357 words
Gangnam Style, --lang ko (9bZkp7q19f0)—youtube-transcript-apinon-Latin UTF-8 intact
Kurzgesagt consciousness10 minfaster-whisper ASR (auto-fallback)1,401 words

All three layers exercised independently and end-to-end.

Gotchas & limits

  • Run from a residential / non-cloud IP. YouTube blocks known cloud-provider IPs (AWS/GCP/Azure) for the caption endpoints; a cloud host needs a residential proxy or the yt-dlp PoToken plugin.
  • PoToken edge case. Some caption tracks return an empty body to layer 1 (youtube-transcript-api issue #592, no upstream fix). Layer 2 covers many of these; for the rest, install the bgutil PoToken plugin.
  • ASR cost is time, not money. Fully local + free. A 2-hour video on CPU with base is slow — use tiny/base for speed, small+ for accuracy. ASR is imperfect (tiny rendered "trunks" as "prompts"); prefer captions when they exist.
  • No hard volume cap, but YouTube temporarily rate-limits heavy bulk scraping from one IP — space requests out for hundreds of videos.

Why this over an off-the-shelf MCP

Surveyed servers (kimtaeyoon83, anaisbetts/mcp-youtube, jkawamoto, sinco-lab) are all caption-only — they error on videos with no captions. This skill's layer-3 ASR fallback is what makes "get the transcript of any video" actually hold.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.