How to get a YouTube transcript
Five ways to get the transcript of a YouTube video: in YouTube itself, with yt-dlp, in Python, through the TranscriptDock API, or by asking Claude.
Updated
Short answer: if the video has captions, YouTube can show its transcript under the description (open ...more, then Show transcript). To get it as a file or for many videos, use yt-dlp or the youtube-transcript-api Python library on your own machine, or one request to a hosted API such as TranscriptDock when you run in the cloud or need TikTok too. Videos without captions need AI transcription of the audio.
Which way to pick#
| Method | Good for | Cost | Catch |
|---|---|---|---|
| YouTube transcript panel | One video, by hand | Free | Only if the video has captions; copying loses the timing |
| yt-dlp | Scripts on your own machine | Free | Subtitle files; blocked from many cloud IPs |
| youtube-transcript-api | Python notebooks and scripts | Free | Needs a residential proxy in the cloud; YouTube only |
| TranscriptDock API | Apps, pipelines, many videos | 1 credit per video | Hosted, TikTok too, AI transcription when there are no captions |
| Claude or Cursor (MCP) | Asking questions about a video | 1 credit per video | No code at all |
1. In YouTube#
- Open the video on a computer.
- Click
...moreunder the title to expand the description. - Scroll to the bottom of the description and click
Show transcript. - The transcript opens beside the video. Use the menu at its top to hide timestamps, then select and copy.
The button only appears when the video has captions, either uploaded by the creator or generated by YouTube. It is fine for one video; copying by hand loses the timing and does not scale.
2. With yt-dlp#
yt-dlp is a free command line tool. This saves the English captions as an SRT file without downloading the video:
yt-dlp --skip-download --write-subs --write-auto-subs --sub-langs en --convert-subs srt \"https://www.youtube.com/watch?v=dQw4w9WgXcQ"
--write-auto-subs includes YouTube's automatic captions when the creator uploaded none. It works well from a home connection; from a server, YouTube often asks it to sign in.
3. In Python#
The open source youtube-transcript-api library reads the same captions with no API key:
# pip install youtube-transcript-apifrom youtube_transcript_api import YouTubeTranscriptApitranscript = YouTubeTranscriptApi().fetch("dQw4w9WgXcQ", languages=["en"])for snippet in transcript:print(round(snippet.start, 1), snippet.text)
Its README warns that YouTube blocks most IP addresses that belong to cloud providers, so on AWS, Google Cloud or a VPS it needs a rotating residential proxy. See TranscriptDock vs youtube-transcript-api.
4. With the TranscriptDock API#
Three requests: submit the link, wait, export. It runs anywhere (no proxy to manage), returns timed segments, exports TXT, SRT, VTT or JSON, and works the same for TikTok. A caption transcript costs 1 credit and every account gets 50 free credits every month.
# 1. submit the link (1 credit)curl -X POST https://www.transcriptdock.com/v1/jobs \-H "Authorization: Bearer td_live_YOUR_KEY" \-H "Idempotency-Key: yt-dQw4w9WgXcQ" \-H "Content-Type: application/json" \-d '{ "source": { "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }, "mode": "captions_only" }'# 2. wait for it (returns as soon as the job finishes)curl "https://www.transcriptdock.com/v1/jobs/JOB_ID?wait=25" -H "Authorization: Bearer td_live_YOUR_KEY"# 3. export the transcript (free)curl "https://www.transcriptdock.com/v1/transcripts/RESULT_ID/export?format=txt" -H "Authorization: Bearer td_live_YOUR_KEY"
The full walkthrough is in the quickstart. For a whole channel, playlist or search, list the videos first with video discovery, then submit them as a batch.
5. Ask Claude or Cursor#
Add TranscriptDock as a connector and ask in plain words, for example "What does this video say?" with the link. Claude fetches the transcript and answers from it. Setup takes a minute: Claude, Claude Code, Cursor.
When a video has no captions#
Every method above reads captions that already exist. When there are none, the audio has to be transcribed. With TranscriptDock send mode: "auto": it uses captions when they exist and AI transcription otherwise, at 2 credits per started minute on paid plans. The result includes word timings.
Common questions#
- Is it allowed? Reading captions for your own research, accessibility or analysis is common practice; republishing someone else's words is a copyright question. Check YouTube's terms for your use.
- Other languages? Pass
caption_languages, such as["es", "en"], to prefer a track. List a video's tracks with language discovery. - Shorts? Yes. Shorts, watch and youtu.be links all work.