Subtext

yt-dlp YouTube transcript download vs a hosted API

If you want a quick local YouTube transcript from the terminal, yt-dlp can pull subtitle tracks without downloading the video. Once you run that command inside Docker, AWS, or an AI workflow, duplicate rolling VTT lines and bot-check errors turn a one-liner into maintenance work.

By Subtext

Get a free API key Read API reference Connect via MCP

The working yt-dlp command for YouTube transcripts

On a personal machine, this command downloads English manual or auto-generated subtitles as a .vtt file while skipping the video itself:

yt-dlp --skip-download --write-subs --write-auto-subs \
  --sub-langs "en.*" --sub-format vtt \
  "https://www.youtube.com/watch?v=arj7oStGLkU"

If you want .srt instead of .vtt, add --convert-subs srt (this requires ffmpeg installed on the machine).

Why yt-dlp breaks in server pipelines

Auto-generated YouTube .vtt files repeat lines across rolling two-line cues and embed inline word-timing tags like <00:01:12.400><c>. Turning that output into clean plain text or LLM-ready paragraphs takes custom parsing and deduplication code.

Cloud and datacenter IPs (AWS, GCP, Vercel, Railway, GitHub Actions) frequently hit YouTube's Sign in to confirm you're not a bot error or HTTP 429 rate limits. To keep jobs running, you end up exporting browser cookies or rotating residential proxies.

YouTube also changes its player scripts regularly, which means updating the yt-dlp binary and maintaining a JavaScript runtime in your container just to fetch caption metadata.

Replace yt-dlp with one HTTP request to Subtext

When your app or script only needs clean transcript text, Markdown, SRT, WebVTT, or structured JSON segments, replace the yt-dlp subprocess with GET https://youtubevideototranscript.com/api/v1/transcript:

export SUBTEXT_API_KEY=stx_...
curl -sS "https://youtubevideototranscript.com/api/v1/transcript?video=arj7oStGLkU&format=text&timestamps=true" \
  -H "Authorization: Bearer $SUBTEXT_API_KEY"

The response is already deduplicated into clean paragraphs (or {start, duration, text} objects when you request format=json), needs no ffmpeg or cookies, and works from any cloud host. To inspect available caption languages before spending a credit, call GET https://youtubevideototranscript.com/api/v1/languages?video=arj7oStGLkU (free).

If you are fetching transcripts inside Claude Code, Cursor, or another AI coding agent, skip shell scripts altogether and connect the remote Subtext MCP server.

When to keep yt-dlp

Keep yt-dlp when you already download the actual video or audio files (for example to run local Whisper on videos without captions), when you run occasional jobs on a residential machine, or when you need cookies for private or members-only videos you own. Subtext reads public captioned YouTube videos only.

Dealing with Python library blocks too? Read fixing youtube-transcript-api RequestBlocked and IpBlocked, compare hosted providers in YouTube transcript API alternatives, or try the free browser downloader.