Updated
Get a YouTube Transcript in Python (with Timestamps)
Try it now on Apify YouTube Transcript for AI: RAG Chunks, Chapters, SRT · $0.002 per one video whose transcript was returned · failed items are free
How to do it, step by step
pip install apify-clientand create a free Apify token (Settings > API & Integrations).- Call the Actor with the code below;
segmentsgives start times in seconds for each caption. - Iterate over the dataset items; each one is a video with
status,text,segmentsandchapters. - Store the
videoIdwith your data so you can link back tohttps://youtu.be/ID?t=SECONDS.
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("plainprobe/youtube-transcript-ai").call(
run_input={"videos": ["https://www.youtube.com/watch?v=zjkBMFhNj_g"], "includeChunks": False})
for video in client.dataset(run["default_dataset_id"]).iterate_items():
print(video["status"], video["title"], video["wordCount"])
for seg in video["segments"][:3]:
print(seg["start"], seg["text"])
The exact input used for the example below:
{
"videos": [
"https://www.youtube.com/watch?v=zjkBMFhNj_g"
],
"includeChunks": false
}Real result
Run Z3Mslzd6t1AcxcAnd on 2026-12-05: status SUCCEEDED, 1 item(s), 2.6 s of run time. Output shortened for reading (long text cut with “…”).
- [1hr Talk] Intro to Large Language Models (59 min): 12,151 words, auto captions in
en, 21 chapters
1,704 timestamped segments came back with the text, in 2.6 s of run time.
[
{
"videoId": "zjkBMFhNj_g",
"title": "[1hr Talk] Intro to Large Language Models",
"durationSeconds": 3588,
"wordCount": 12151,
"chapters": [
{
"start": 0,
"title": "Intro: Large Language Model (LLM) talk",
"end": 20
},
{
"start": 20,
"title": "LLM Inference",
"end": 257
},
{
"start": 257,
"title": "LLM Training",
"end": 538
},
"… 18 more"
],
"segments": [
{
"start": 0.16,
"dur": 4.08,
"text": "hi everyone so recently I gave a"
},
{
"start": 2.28,
"dur": 4.119,
"text": "30-minute talk on large language models"
},
{
"start": 4.24,
"dur": 4.24,
"text": "just kind of like an intro talk um"
},
"… 1701 more"
]
}
]
FAQ
Is there a free option?
The open-source youtube-transcript-api package is free and fine on a home connection. The Actor is the paid option for servers and batches; the first 100 transcripts per Apify account are free until 31 January 2027.
Can I call it asynchronously?
Yes: client.actor(...).start() returns at once; read the dataset when the run finishes, or use a webhook.
What do segments look like?
Each segment has start and end in seconds and the caption text, so you can cite an exact moment.