
YouTube Transcript API
A JavaScript/TypeScript library for extracting YouTube transcripts. No API keys, no Selenium. Supports multiple formats and languages.
Rajat Mehra / 2026-01-24
2 min read • 302 characters
Why I Built This
I was building a YouTube video summarizer and needed transcripts. The existing JavaScript libraries either required a YouTube API key or depended on Selenium for browser automation. I didn't want either - an API key adds friction for users, and Selenium is heavy for what should be a simple HTTP request.
So I looked at how YouTube actually serves transcripts (it's an undocumented XML endpoint), reverse-engineered the request flow, and built a library that fetches transcripts with plain HTTP calls. No API keys, no browser automation, no dependencies beyond Axios.
I also noticed the gap on npm - there wasn't a good JS/TS library for this. So I published it as a standalone package.
Tech Stack
- TypeScript - Type-safe development
- Axios - HTTP requests
- Commander.js - CLI framework
- http-proxy-agent - Proxy support
- Jest - Testing
Key Features
- No API key required - Works by fetching YouTube's undocumented transcript endpoint directly.
- Manual and auto-generated captions - Supports both caption types with language priority ordering.
- Four output formats - JSON (structured with timestamps), plain text, SRT, and WebVTT.
- Translation support - Translate transcripts to different languages when YouTube provides translations.
- CLI tool - Extract transcripts from the command line without writing code.
- Proxy support - Generic proxy and Webshare rotating proxy integration for high-volume use.
- Error handling - Specific errors for unavailable videos, disabled transcripts, and rate limiting.
What Came Next
This library became the transcript layer for Rundownly, a desktop YouTube summarizer I built with Tauri and Rust. The library handles transcript extraction; Rundownly adds AI summarization, timestamps, and a native desktop UI on top of it. What started as an npm package turned into the foundation for a full product.