Python
YouTube Transcript API in Python: A 5-Minute Quickstart
Fetch YouTube transcripts in Python with a few lines of requests or httpx. Includes batching, language selection, error handling and retries against the Toucora API.
By the Toucora team · 2026-09-29 · 7 min read
One request, one transcript
The shortest path is a single GET to /v1/transcripts/{videoId} with your key in the Authorization header. The response is JSON: video id, language, duration and a list of segments. No SDK is required — Python’s requests or httpx is enough.
Choosing a language and format
Call /v1/transcripts/{videoId}/languages first when a video may be multilingual, pick the track you want, then pass ?lang= and ?format=. Asking for srt or vtt returns ready-to-save subtitles; asking for json keeps the structured segments.
Batching and retries
For lists of videos, POST up to 50 ids to /v1/transcripts in one call and read per-item results. Wrap requests with a timeout and a small exponential backoff: transient upstream hiccups and 429 rate limits both clear quickly, and every response carries an X-Request-ID you can log for support.
Handling the awkward cases
Some videos have no captions, some are private, and some are region-locked. The API answers with a typed error code and a human-readable message, so your code branches on the code rather than parsing prose. Log the request id; that is the fastest route to a fix.
Frequently asked questions
Do I need an SDK?
No. Any HTTP client works. A thin wrapper around requests is plenty for most projects.
How do I batch many videos?
Send up to 50 video ids to POST /v1/transcripts; larger sets belong in a playlist or channel job.
What about async Python?
Use httpx.AsyncClient with the same endpoints and a bounded semaphore to control concurrency.
Keep reading
Try the API on a video
Create a free developer key and pull your first transcript in a minute.
Get an API key →