Almost everything said on YouTube is already written down in captions, and getting that text out programmatically is still weirdly painful. The popular open-source libraries work until your IP gets blocked, and the official route does not cover the videos you actually want. This post walks the DIY path, where it breaks, and the shortcut: the YouTube Transcript API on Apify, which takes a list of video URLs and returns transcripts in bulk as structured JSON.
Disclosure: the Apify links in this post are affiliate links. If you run the Actor, I may earn a referral commission at no extra cost to you.
Does the YouTube Data API give you transcripts?
Not for arbitrary videos. The Data API's captions endpoint requires the video owner's authorization to download caption tracks, which is fine for your own channel and useless for research across other people's videos. That is why every practical pipeline ends up scraping caption data, and why a hosted transcript API you can hammer in bulk exists at all.
What the YouTube Transcript API returns
The YouTube Transcript API returns one row per video: the full transcript as a single text field, timestamped snippets when you want alignment, and the metadata that makes a dataset citable.
| Field | Example | Notes |
|---|---|---|
non_timestamped |
welcome back everyone today... |
The whole transcript as one string |
timestamped |
[{ "text": "welcome back", "start": 0.0, "duration": 2.1 }] |
Snippet-level alignment |
language_code |
en |
The track that was fetched |
source_type |
Auto-generated |
Manual captions vs auto captions, a real quality signal |
title |
How Transformers Work |
With channel_name, upload_date, view_count
|
success |
true |
Failures arrive as error rows, not dead runs |
Videos, Shorts, and every YouTube URL format are accepted, and SRT output is available through output_formats when subtitle files are the goal.
Who this is for
AI builders assembling LLM training or RAG corpora from spoken content, content teams repurposing videos into posts, and researchers running keyword or discourse analysis across channels.
The manual way, and where it breaks
The usual DIY stack is a caption-fetching library in a loop. It works on your laptop for twenty videos, then production traffic hits YouTube's rate limits and the blocks start: silent empty responses, then errors, then nothing until you rig rotating proxies. Auto-generated tracks, translated tracks, and Shorts each behave a little differently, and batch error handling is on you. None of that is interesting work; it is just toll.
The faster way: run the YouTube Transcript API
Apify Console
- Open the YouTube Transcript API and click Try for free.
- Paste video URLs into
youtube_url, optionally setlanguagesortranslate_to. - Run it and export JSON, CSV, or SRT-formatted fields.
REST
curl -X POST "https://api.apify.com/v2/acts/johnvc~YoutubeTranscripts/runs?token=YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "youtube_url": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"], "languages": ["en"], "output_formats": ["srt"] }'
Endpoint reference: the Apify API docs.
Download YouTube transcripts in Python
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("johnvc/YoutubeTranscripts").call(
run_input={
"youtube_url": [
"https://www.youtube.com/watch?v=jNQXAC9IVRw",
"https://www.youtube.com/watch?v=dQw4w9WgXcQ",
],
"languages": ["en"],
"include_metadata": True,
}
)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item["language_code"], item["title"], item["non_timestamped"][:120])
There is a Node.js variant published as a task if JavaScript is home.
Download a batch of transcripts in bulk
The bulk pattern is the point. Download a batch of YouTube transcripts in bulk feeds a URL list and collects one row per video, error rows included.
Escape the IP-block treadmill
If you arrived here because your library calls started failing, YouTube transcript API in Python, no IP block and no rate limit are the tasks that show the hosted alternative on your exact problem.
Translate subtitles across languages
translate_to converts any available track into a target language: see Translate YouTube subtitles via API. Language-specific tasks cover collection in Spanish, Hindi, and a couple dozen more.
Grab Shorts transcripts too
Shorts carry captions like any video: Get YouTube Shorts transcript by URL handles the short-form URLs directly.
Wire transcripts into Claude via MCP
This Actor runs as a hosted MCP tool, so Claude, Claude Code, Cursor, and ChatGPT can fetch a transcript mid-conversation and summarize, quote, or index it. Start from the hosted YouTube transcript MCP server task or the Claude Code setup, and read more about Claude at claude.ai.
FAQ about scraping YouTube transcripts
How much does the YouTube transcript scraper cost?
Pay per video, at $0.00001 per video processed, and failed videos are free. At that rate the free platform credit on a new Apify account covers thousands of videos, which is why I stopped counting.
Can the scraper build LLM training data?
Yes, it is the cleanest use case: non_timestamped is the training-text column, source_type flags auto captions versus human ones, and the metadata fields document provenance for your dataset card.
Can Claude or Cursor call this transcript scraper over MCP?
Yes, natively over the hosted MCP endpoint, and the example tasks include exact setups for Claude, Claude Code, Cursor, ChatGPT, VS Code, Cline, and Windsurf.
Can I schedule the scraper to transcribe new videos automatically?
Yes. Keep a URL list as a task, attach a weekly Apify schedule, and each run appends transcripts for whatever is new. Start from the YouTube Transcript API page.
What can't this transcript scraper do?
It cannot conjure text where no captions exist and it does not run speech-to-text; a video with captions disabled comes back as an error row. If a track exists in the wrong language, translate_to is the workaround.
More from Truffle Pig Data
Longer reads on the same Actor: YouTube Transcript API for AI Agents on Medium, the LinkedIn article, and the Peerlist bulk-download guide.
Wrapping up
The words are already on YouTube; you just need them as text. Feed your URL list to the YouTube Transcript API and take the transcripts home as JSON.
Top comments (0)