youtube-transcript-api

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

SDK
PyPI
v1.2.4
8,073stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
53/100Fair
Development Activity16
Maintenance32
Community64
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
73/100Good
Architecture70
Code Quality72
Innovation65
Learning Curve85

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

Devops · AI Development · Automation

41,774

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

View details
93
Repo Health
87
Technical
67
Dependency
Built with
Python100%
Updated today
Python
97%
MIT

auto-news

AI Assistants · Productivity

906

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
Python97%
Updated 1 years ago
Python
68%
Other

AutoGPT

Automation · Productivity · AI Assistants

186,687

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
67
Dependency
Built with
Python68%
TypeScript31%
Updated today
Python
68%
MIT

Langflow

AI Agents · AI Development

153,450

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

View details
90
Repo Health
85
Technical
66
Dependency
Built with
Python68%
TypeScript22%
Updated today
Python
37%
Other

Open WebUI

AI Assistants · AI Agents

149,204

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
Python37%
Svelte33%
JavaScript22%
Updated today
Python
69%
Apache 2.0

SurfSense

Search · AI Assistants

15,960

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

View details
88
Repo Health
71
Technical
66
Dependency
Built with
Python69%
TypeScript28%
Updated today

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

Search