DEV Community

Siftwright
Siftwright

Posted on

Get YouTube transcripts in bulk: text, SRT and VTT from Python, pay only per result

Getting a YouTube transcript sounds trivial until you need it for 500 videos: the official Data API doesn't return caption text for videos you don't own, libraries break when YouTube changes a page, and a plain requests loop gets rate-limited fast.

This post shows a small, honest workflow: send video URLs or IDs to an Apify Actor, get back clean text, timestamped segments and ready-to-use SRT/VTT subtitles, and only pay for transcripts that were actually returned.

Try it without writing code

Paste a link into the free tools page at https://siftwright.com/tools/ or open the Actor directly: https://apify.com/siftwright/youtube-transcript-extractor

Python

from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("siftwright/youtube-transcript-extractor").call(run_input={
    "urls": ["jNQXAC9IVRw"],          # URL, Shorts link, playlist, channel or bare ID
    "language": "en",
    "outputFormats": ["text", "segments", "srt"],
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["title"], item["status"], item["wordCount"])
    print(item["text"])
Enter fullscreen mode Exit fullscreen mode

Real output

I ran it on the first video ever uploaded to YouTube ("Me at the zoo", 19 seconds). The result, trimmed:

{
  "videoId": "jNQXAC9IVRw",
  "status": "ok",
  "title": "Me at the zoo",
  "channelName": "jawed",
  "durationSeconds": 19,
  "language": "en",
  "isAutoGenerated": false,
  "availableLanguages": [{"code": "en"}, {"code": "de"}],
  "wordCount": 39,
  "text": "All right, so here we are, in front of the elephants the cool thing about these guys is that they have really... really really long trunks and that's cool (baaaaaaaaaaahhh!!) and that's pretty much all there is to say"
}
Enter fullscreen mode Exit fullscreen mode

The srt field comes back as a ready-to-save subtitle file:

1
00:00:01,200 --> 00:00:03,360
All right, so here we are, in front of the elephants

2
00:00:05,318 --> 00:00:07,974
the cool thing about these guys is that they have really...
Enter fullscreen mode Exit fullscreen mode

curl

curl -X POST "https://api.apify.com/v2/acts/siftwright~youtube-transcript-extractor/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" -H "Content-Type: application/json" \
  -d '{"urls":["jNQXAC9IVRw"],"outputFormats":["text","srt"]}'
Enter fullscreen mode Exit fullscreen mode

Useful options

  • Playlists and channels: pass a playlist or @handle URL and set maxVideosPerSource.
  • Translation: translateTo: "de" uses YouTube's built-in machine translation.
  • Prefer human captions: on by default; falls back to auto-generated.
  • Metadata (title, channel, views, keywords) is included at no extra charge.

Pricing and limits

Pricing is pay per event: $0.003 per transcript returned ($3 per 1,000). Videos with no captions, private videos and failures are reported in the dataset with a status and are not charged. Limits: a video needs captions (manual or auto-generated) to have a transcript, and some fields such as publish date can be empty depending on what YouTube exposes.

Using it from an AI agent

The same Actor works through Apify's MCP server, and Siftwright also runs a hosted MCP endpoint at https://siftwright.com/mcp so an agent can fetch transcripts as a tool call.

If something breaks on a video you care about, tell us at support@siftwright.com and include the video ID.

Top comments (0)