All guides

November 19, 2026 · 5 min read

youtube-transcript-api: Translate a Transcript to English in Python

In short

Translate a YouTube transcript to English in Python with youtube-transcript-api's translate(), why it raises NotTranslatable or IpBlocked, and an API fallback.

To translate a transcript to English with youtube-transcript-api, list the video's tracks, pick one, and call .translate("en").fetch() on it: YouTube machine-translates the captions and keeps every timestamp. It only works when the track is marked translatable and YouTube answers the translated caption request, so this guide covers the code, the errors you will hit, and the TranscriptYT API's language and translate_to parameters, which do the same job from any server. If you just need one video in English, paste it into the free YouTube transcript translator.

How to translate a YouTube transcript to English with youtube-transcript-api

In the current version of the library (the instance-based API from the jdepoix/youtube-transcript-api repository), translation is a method on a Transcript object, not an argument to fetch(). You get Transcript objects from list(), choose the source track, and call translate() with a target language code. translate() does no network work by itself: it returns a new Transcript whose caption URL has &tlang=en appended. The request to YouTube happens when you call fetch().

The result is a FetchedTranscript with the same structure as an untranslated one: a list of snippets, each with text, start, and duration in seconds. The timings come from the source track, so you can write the English lines to an SRT file or line them up with the original text by index.

The steps:

from youtube_transcript_api import YouTubeTranscriptApi

video_id = "VIDEO_ID"
tracks = YouTubeTranscriptApi().list(video_id)

# Any track will do as the source; this takes the first German one.
source = tracks.find_transcript(["de", "de-DE"])

english = source.translate("en").fetch()
for snippet in english.to_raw_data()[:5]:
    print(f"{snippet['start']:>7.1f}s  {snippet['text']}")
  • Call YouTubeTranscriptApi().list(video_id) to get every caption track on the video.
  • Pick a source track with find_transcript(), find_manually_created_transcript(), or find_generated_transcript(). Prefer a manually created track; its text is cleaner, so the translation is too.
  • Call .translate("en") on that track, then .fetch().
  • Use .to_raw_data() if you want plain dicts with text, start, and duration.

Translate whatever language the video is in

Most of the time you don't know the source language in advance. Two rules handle it. First, if the video already has an English track, use it instead of translating; human captions beat machine translation. Second, otherwise take any track that is translatable, preferring a manually created one. The auto-generated track is always in the spoken language, so it is a sensible last choice.

Note the fetch() default: YouTubeTranscriptApi().fetch(video_id) asks for languages=("en",) and raises NoTranscriptFound on a video with no English track, even when it has captions in other languages. The function below avoids that by listing tracks first.

from youtube_transcript_api import YouTubeTranscriptApi

def english_transcript(video_id):
    tracks = list(YouTubeTranscriptApi().list(video_id))

    native = [t for t in tracks if t.language_code.split("-")[0] == "en"]
    if native:
        best = next((t for t in native if not t.is_generated), native[0])
        return best.fetch().to_raw_data()

    translatable = [t for t in tracks if t.is_translatable]
    if not translatable:
        return None
    source = next((t for t in translatable if not t.is_generated), translatable[0])
    return source.translate("en").fetch().to_raw_data()

translate() errors: NotTranslatable, TranslationLanguageNotAvailable, IpBlocked

translate() checks two things before it builds the new URL, and fetch() can fail for the usual network reasons. These are the exceptions you will see and what each one means:

  • NotTranslatable: the track has an empty translation_languages list, so YouTube offers no machine translation for it. Try another track on the same video; some videos have one translatable track and one that is not.
  • TranslationLanguageNotAvailable: the code you passed is not in the track's translation_languages. Codes must match exactly, so check spelling and regional variants by printing [l.language_code for l in track.translation_languages].
  • IpBlocked or RequestBlocked: YouTube refused the request. The library raises IpBlocked for any HTTP 429. This is common on cloud servers, and translated caption requests (the ones with tlang) are especially prone to 429s.
  • PoTokenRequired: the caption URL YouTube returned needs a proof-of-origin token the library cannot produce, so neither the original nor the translation can be fetched.
  • TranscriptsDisabled: the video has no captions at all, so there is nothing to translate.

Limits of youtube-transcript-api translation

Even when translate() works, a few limits matter for anything beyond a notebook:

from youtube_transcript_api import (
    IpBlocked,
    NotTranslatable,
    TranslationLanguageNotAvailable,
)

try:
    english = source.translate("en").fetch()
except (NotTranslatable, TranslationLanguageNotAvailable):
    english = None  # try another track, or translate the text yourself
except IpBlocked:
    english = None  # retry later, through a proxy, or via an API
  • It is YouTube's machine translation of the caption text, line by line. Each snippet is translated on its own, so sentences that span two caption cues can read awkwardly in English.
  • A translated transcript cannot be translated again. Its translation_languages is empty and is_generated is True, so to get several target languages you call translate() on the original track once per language.
  • Every target language is a separate request to YouTube, which counts toward the same rate limits that cause IpBlocked. Translating 500 videos into English is 500 extra requests on top of listing them.
  • Without a caption track there is nothing to translate. Videos with captions disabled need speech-to-text first, as covered in how to transcribe a YouTube video without captions.
  • Code from servers in AWS, GCP, or similar ranges usually gets blocked before it reaches the translation step. The RequestBlocked guide explains the proxy options.

Translate to English with the TranscriptYT API language parameter

The TranscriptYT /v1/transcript endpoint has two parameters for this, documented in the API reference. language=en returns the video's English track when one exists; if the video has no English track, the original is machine-translated into English and the response has translated: true. translate_to=en always translates whichever track language selects (the original or English track by default), and keeps every segment's start and duration.

Translation runs on our side, not through YouTube's tlang URLs, so it does not depend on YouTube's translated-caption rate limits, and a request blocked by YouTube is retried on a fresh exit IP. A translated transcript costs the same 1 credit as any other transcript, in any output format: json, text, srt, vtt, csv, or md.

import os
import requests

API = "https://transcript-yt.com/v1/transcript"
HEADERS = {"Authorization": f"Bearer {os.environ['TRANSCRIPTYT_KEY']}"}

res = requests.get(
    API,
    params={"url": "VIDEO_ID", "language": "en"},
    headers=HEADERS,
    timeout=120,
)
res.raise_for_status()
data = res.json()
print(data["language"], data["translated"])
print(data["text"][:300])

# English subtitles with the original timings, straight to a file
srt = requests.get(
    API,
    params={"url": "VIDEO_ID", "translate_to": "en", "format": "srt"},
    headers=HEADERS,
    timeout=120,
)
srt.raise_for_status()
open("english.srt", "w", encoding="utf-8").write(srt.text)

Check which languages a video has before translating

GET /v1/languages returns the video's caption tracks plus every language translate_to accepts, and it does not cost a credit. Use it the way you would use list() in the library: to decide whether a native English track exists, or to show users a language picker.

A few cases to know about. If the video has no captions, a paid plan or credit pack transcribes the audio with AI at 1 credit per started minute, and language and translate_to work the same way on that transcript; on the Free plan (100 credits, one time) a caption-less video returns NO_CAPTIONS. With originalLanguage=true and no language set, you get the captions in the language actually spoken instead of the English track, which is useful when you want both the source text and a translate_to=en copy.

langs = requests.get(
    "https://transcript-yt.com/v1/languages",
    params={"url": "VIDEO_ID"},
    headers=HEADERS,
    timeout=60,
).json()

has_english = any(t["languageCode"].startswith("en") for t in langs["languages"])
print(has_english, len(langs["translationLanguages"]))

Which one to use

Whichever route you pick, read a sample of the English output before shipping it. Machine translation of auto-generated captions compounds two sets of errors: the speech recognition misheard words, then the translator works from those words. Names, numbers, and technical terms are where it goes wrong most often.

For a script on your own laptop, a handful of videos, and captions that are already translatable, youtube-transcript-api's translate() is free and enough. Wrap it in try/except for NotTranslatable, TranslationLanguageNotAvailable, and IpBlocked, and fall back to a different track before giving up.

For a backend that translates many videos, runs on cloud infrastructure, or needs English for videos without captions, the API's language and translate_to parameters remove the per-language YouTube requests and the blocking. The youtube-transcript-api comparison goes through the other differences. For one-off reading, the free translator tool shows the original line above each English line and downloads SRT or VTT.

Common questions

How do I translate a YouTube transcript to English in Python?

With youtube-transcript-api, call YouTubeTranscriptApi().list(video_id), pick a track, and run .translate("en").fetch() on it. With the TranscriptYT API, request /v1/transcript with language=en or translate_to=en.

Why does translate() raise NotTranslatable?

The track you picked has no translation languages, so YouTube offers no machine translation for it. Try another track on the same video, or translate the text yourself after fetching it.

Why does fetching a translated transcript give IpBlocked?

youtube-transcript-api raises IpBlocked for any HTTP 429 from YouTube. Translated caption requests are rate limited and cloud IPs are often blocked outright, so this is common on servers.

Can I translate a transcript into several languages at once?

In youtube-transcript-api, call translate() on the original track once per language; a translated transcript cannot be translated again. In the TranscriptYT API, send one request per translate_to code, each costing 1 credit.

Try the YouTube Transcript API

Get transcripts as JSON, text, SRT, or VTT. 100 free credits, no card required.

More guides