Transcripts and translation
Get what is said in a video as timed segments, SRT, VTT or plain text, in the original language or translated.
A transcript is the cheapest way for an agent to understand a video: one synchronous request, a few kilobytes of text, no job. Reach for it before a download.
Get a transcript
ayt transcript dQw4w9WgXcQ --json # timed segments
ayt transcript dQw4w9WgXcQ --format txt # just the words
ayt transcript dQw4w9WgXcQ --format srt -o subs.srtcurl "https://api.agentic-yt.crafter.run/v1/videos/dQw4w9WgXcQ/transcript?format=json" \
-H "Authorization: Bearer $AGENTIC_YT_TOKEN"| Parameter | Default | Notes |
|---|---|---|
lang | the video's original language | A language code: en, es, pt-BR. |
translate_to | — | Machine-translate into this language code. |
format | json | json, srt, vtt or txt. |
Formats
The response is always JSON, whatever format is:
{
"video_id": "dQw4w9WgXcQ",
"language": "en",
"kind": "manual",
"format": "json",
"segments": [
{ "start": 18.64, "end": 21.88, "text": "We're no strangers to love" }
],
"cache_hit": false
}format=json→segments, each withstartandendin seconds.format=srt,vttortxt→ the rendered text incontent(a string), and nosegments.
So over HTTP you read content out of the JSON; the CLI does that for you and prints or saves the
text itself.
txt is what to feed a model for summarising. json is what to use when the agent needs to cite a
timestamp or pick a range to clip.
Which captions you get
kind tells you what you received:
kind | Meaning |
|---|---|
manual | Captions written or uploaded by the channel. The most accurate. |
auto | YouTube's automatic speech recognition. No punctuation guarantees; names are often wrong. |
translated | Machine translation of one of the above. |
With no lang, you get the video's original language. Within a language, manual captions are
preferred over automatic ones.
List the languages
ayt languages dQw4w9WgXcQ --jsonGET /v1/videos/{id}/transcript/languages returns:
languages— the caption tracks that exist:{ lang, name, kind, translatable }withkindmanualorauto.translation_languages— the values accepted astranslate_to.
Call it when a transcript request comes back not_found: that means the video has no captions in
the language you asked for, and this tells you which it does have.
Translate
ayt transcript dQw4w9WgXcQ --translate-to es --format txttranslate_to asks YouTube to machine-translate the track. The response has kind: "translated"
and language set to the target. Combine it with lang to choose which track is translated — for
instance to translate the manual English captions rather than an automatic track:
ayt transcript <ref> --lang en --translate-to pt-BRThe quality is that of YouTube's machine translation. For anything that matters, fetch the original
with --format txt and have your model translate it.
Caching
Transcripts are cached for 30 days per video, language and kind. cache_hit: true means YouTube
was not contacted. There is no fresh parameter: captions practically never change after
publication.
Errors to expect
not_found— no captions in the requested language. List the languages and retry with one that exists, or withtranslate_to.video_unavailable— the video itself cannot be read.youtube_blocked— retry after a pause.
A video with no captions at all — music without lyrics captions, some live streams — has no transcript to give. Download the audio and transcribe it yourself.