🛠️ View Sample SDK on GitHub
💳 Pricing & Signup COMING SOON
A simple YouTube-to-Text API that fetches transcripts from YouTube videos.
- Primary method: Uses
youtube_transcript_api
with proxy rotation for reliability - Fallback #1: Uses
yt-dlp
to scrape auto-captions - Fallback #2: Downloads audio and uses local Whisper CLI for transcription
The API provides:
- Environment variable loading
- Proxy rotation functionality
- Multiple retry mechanisms
- A Flask API endpoint at
/transcript/<video_id>
that returns transcription data
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…" },
…
]
}
source
: Source of the transcript (which method succeeded)language
: Language informationis_generated
: Whether the transcript was auto-generatedsegments
: Transcript segments with timing information
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"));
})();