youtube-transcript-api

Fetch transcripts and auto-generated subtitles for any YouTube video in Python

SDK
PyPI
v1.2.4
8,389 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
61 /100 Good
Development Activity 44
Maintenance 36
Community 64
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
73 /100 Good
Architecture 70
Code Quality 72
Innovation 65
Learning Curve 85

youtube-transcript-api retrieves the transcript or subtitle track for a given YouTube video ID directly, without needing a headless browser or an official YouTube Data API key. It works for both manually-created and automatically-generated (ASR) captions, supports listing all available transcript languages for a video, and can translate a transcript into another language using YouTube’s built-in translation feature.

The package ships both a Python API (YouTubeTranscriptApi) and a CLI (youtube_transcript_api) for one-off lookups, plus pluggable output formatters (plain text, JSON, SRT, WebVTT) for converting the raw transcript data into common subtitle formats. It’s widely used in content-summarization tools, transcript-search products, and LLM data pipelines that need YouTube video text without downloading and transcribing the video itself.

What You Get

  • A YouTubeTranscriptApi.fetch()/list() API to retrieve or enumerate a video’s available transcript tracks by video ID
  • Support for both human-created captions and YouTube’s automatically-generated (ASR) subtitles
  • Built-in transcript translation into any language YouTube offers translation for, via the same API
  • A CLI (youtube_transcript_api) for fetching transcripts from the command line without writing Python
  • Pluggable formatters (TextFormatter, JSONFormatter, SRTFormatter, WebVTTFormatter) to convert raw transcript data into common subtitle/text formats
  • Proxy support for routing requests through HTTP/SOCKS proxies or third-party proxy services to avoid IP-based rate limiting

Common Use Cases

  • Feeding YouTube video transcripts into an LLM pipeline for summarization or question-answering over video content
  • Building a searchable transcript index across a channel or playlist’s videos
  • Extracting subtitles in SRT/WebVTT format for downstream video-editing or accessibility workflows
  • Translating a video’s transcript into a different language programmatically for localization
  • Quickly checking, from the command line, what transcript languages are available for a given YouTube video

Under The Hood

Architecture - The core lookup logic lives in _transcripts.py (~490 lines), which handles parsing YouTube’s internal caption-track metadata for a given video ID, selecting the requested language/track, and fetching+parsing the XML-based transcript payload; _api.py (~130 lines) exposes the public YouTubeTranscriptApi class as a thin, stable facade over that internal machinery, while formatters.py converts the resulting transcript objects into text/JSON/SRT/WebVTT, and _cli.py/__main__.py wire the same API into a command-line entry point. Tech Stack - A dependency-light Python package (requests-based HTTP calls, defusedxml for safe XML parsing of caption data) packaged with Poetry; proxies.py adds optional proxy-provider integrations for users hitting YouTube’s rate limits at scale. Code Quality - The youtube_transcript_api/test directory includes dedicated test modules for the API surface, CLI, formatters, and proxy handling, giving reasonable coverage of the package’s main entry points; the project is typed (ships a py.typed marker) though development pace has slowed (low recent commit activity) even as the underlying YouTube page format it scrapes continues to change. API Design - The public surface is deliberately small — one main class with fetch/list methods and a handful of formatter classes — making it easy to get a transcript in a few lines of code, though because it depends on scraping YouTube’s undocumented internal caption delivery format rather than an official stable API, breaking changes on YouTube’s side occasionally require library updates.

Used by 6 apps in this directory

Python
100%
Apache 2.0

Agno

AI Development · Automation · Devops

42,358

Build, run, and manage agent platforms with a full production stack — SDK, runtime, and control plane included.

View details
93
Repo Health
87
Technical
66
Dependency
Built with
Python 100%
Updated 4 days ago
Python
97%
MIT

auto-news

AI Assistants · Productivity

908

An AI-powered personal news aggregator that filters multi-source feeds through LLMs and delivers curated, noise-free summaries to your Notion workspace.

View details
43
Repo Health
53
Technical
66
Dependency
Built with
Python 97%
Updated 1 years ago
Python
66%
Other

AutoGPT

AI Assistants · Automation · Productivity

187,596

Build, deploy, and run autonomous AI agents that automate complex multi-step workflows using a visual block-based graph editor.

View details
93
Repo Health
78
Technical
66
Dependency
Built with
Python 66%
TypeScript 33%
Updated 4 days ago
Python
69%
MIT

Langflow

AI Agents · AI Development

155,319

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
65
Dependency
Built with
Python 69%
TypeScript 22%
Updated 4 days ago
Python
37%
Other

Open WebUI

AI Agents · AI Assistants

153,390

The extensible, privacy-first AI platform that runs Ollama, OpenAI, and any LLM backend behind a polished, feature-packed web interface.

View details
91
Repo Health
75
Technical
66
Dependency
Built with
Python 37%
Svelte 34%
JavaScript 21%
Updated 4 days ago
Python
67%
Apache 2.0

SurfSense

AI Assistants · Search

16,270

The open-source, unlimited NotebookLM alternative with real-time collaboration, a desktop app, and no vendor lock-in.

View details
87
Repo Health
71
Technical
66
Dependency
Built with
Python 67%
TypeScript 30%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers