YouTube Transcriber logoYouTube Transcriber
API Reference

Code examples

Fetch a YouTube transcript in a few lines, with an optional retry helper for production.

Two versions of the same call. Start with Simple to get going in seconds. When you ship to production, swap in With retries so transient 408 / 429 / 502 responses heal automatically. Replace ytt_your_key_here with your key.

Simple

cURL

curl "https://getyoutubetranscriber.com/api/v2/transcript?video_url=dQw4w9WgXcQ" \
  -H "Authorization: Bearer ytt_your_key_here"

Python

import requests

url = "https://getyoutubetranscriber.com/api/v2/transcript"
headers = {"Authorization": "Bearer ytt_your_key_here"}
params = {"video_url": "dQw4w9WgXcQ"}

data = requests.get(url, headers=headers, params=params).json()
print(data["language"], len(data["transcript"]), "segments")

Node.js

const url = "https://getyoutubetranscriber.com/api/v2/transcript?video_url=dQw4w9WgXcQ";
const res = await fetch(url, {
  headers: { Authorization: "Bearer ytt_your_key_here" },
});
const data = await res.json();
console.log(data.language, data.transcript.length, "segments");

With retries

A small wrapper that retries on 408 / 429 / 502, honors Retry-After, and gives up after three attempts. Call it the same way you would call requests.get or fetch; the retry logic stays out of your way.

Python

import time, requests

def get_with_retry(url, **kwargs):
    for attempt in range(3):
        r = requests.get(url, **kwargs)
        if r.status_code not in (408, 429, 502):
            return r
        wait = int(r.headers.get("Retry-After", 2 ** attempt))
        time.sleep(wait)
    return r

r = get_with_retry(
    "https://getyoutubetranscriber.com/api/v2/transcript",
    headers={"Authorization": "Bearer ytt_your_key_here"},
    params={"video_url": "dQw4w9WgXcQ"},
)
r.raise_for_status()
print(r.json()["language"])

Node.js

async function fetchWithRetry(url, init) {
  for (let attempt = 0; attempt < 3; attempt++) {
    const res = await fetch(url, init);
    if (![408, 429, 502].includes(res.status)) return res;
    const wait = Number(res.headers.get("retry-after")) || 2 ** attempt;
    await new Promise((r) => setTimeout(r, wait * 1000));
  }
  return fetch(url, init);
}

const res = await fetchWithRetry(
  "https://getyoutubetranscriber.com/api/v2/transcript?video_url=dQw4w9WgXcQ",
  { headers: { Authorization: "Bearer ytt_your_key_here" } },
);
const data = await res.json();
console.log(data.language);

See Errors for the full status-code table and Rate limits for per-plan throughput and the RateLimit-* response headers.