View on GitHub

youtube-to-text-backend

Fetch Youtube video's transcripts in 50+ languages

🛠️ View Sample SDK on GitHub 💳 Pricing & Signup COMING SOON

A simple YouTube-to-Text API that fetches transcripts from YouTube videos.

The API provides:

Example Input (URL)

https://api.youtubetotext.com/transcript/WTPlp90DvM0

Replace WTPlp90DvM0 with a valid video ID (which you can obtain by opening a Youtube video page and copying the tail of the URL)

Output (JSON)

{
  "source":       "whisper-cpp" | "youtube-transcript-api" | "yt-dlp",
  "language":     "English",
  "language_code":"en",
  "is_generated": true,
  "segments": [
    { "start": 0.00, "duration": 3.24, "text": "Hello and welcome…" },
    
  ]
}

Base URL: https://api.youtubetotext.com


Quickstart

cURL

curl "https://api.youtubetotext.com/transcript/{VIDEO_ID}?lang={lang}" \
  -H "Authorization: Bearer YOUR_API_KEY"

Python

from youtubetotext.client import YouTubeToText

client = YouTubeToText(api_key="YOUR_API_KEY")
response = client.transcript("VIDEO_ID", lang="es,fr")
for segment in response["segments"]:
    print(segment["text"])

JavaScript (Node.js)

import { getTranscript } from './examples/js_example.js';

(async () => {
  const segments = await getTranscript("VIDEO_ID", "YOUR_API_KEY", "en");
  console.log(segments.map(s => s.text).join("\n"));
})();