A fast, zero-scraping command-line toolkit that fetches YouTube transcripts
directly via the caption API, then uses the Anthropic Claude API to reformat
them into clean paragraphs and produce multi-mode summaries.
No Selenium. No BeautifulSoup. No headless browsers. Two AI-powered
post-processing features built on top of direct caption API access.
Architecture
main.py CLI entry point — five commands (fetch, list, clean, summarize, pipeline)
fetcher.py Direct YouTube caption API — no HTML parsing
cleaner.py AI paragraph reformatter (Anthropic Claude)
summarizer.py AI summarizer with 4 output modes (Anthropic Claude)
pipeline.py Orchestrates fetch -> clean -> summarize in one pass
ai_client.py Shared Anthropic API wrapper with chunking and streaming
config.py Model names, limits, summary modes, defaults
Features
Direct caption API — transcript fetch is near-instant regardless of video length
Paragraph Cleaner — reformats fragmented auto-captions into readable prose (no content removed)
Summarizer — four modes: brief, detailed, bullet points, hierarchical outline
Full pipeline — fetch + clean + summarize in a single command
Token streaming — see AI output in real time as it generates
Automatic chunking — handles transcripts of any length by splitting and merging
Fast model by default (claude-haiku), quality model available via --quality flag
Batch processing — multiple video IDs/URLs in one command
Output formats — plain text, JSON, SRT, WebVTT for the raw transcript
usage: main.py {fetch,list,clean,summarize,pipeline} [options] video [video ...]
commands:
fetch Fetch raw transcript (no AI)
list List available transcript languages
clean Fetch + AI paragraph formatting
summarize Fetch + AI summarization
pipeline Fetch + clean + summarize in one pass
shared options:
-l, --languages LANG [LANG ...] Language codes, in order of preference
-o, --output PATH Output file (single) or directory (batch)
--quality Use higher-quality Claude model
--no-stream Disable live token streaming
fetch / pipeline options:
-f, --format {text,json,srt,vtt} Raw transcript format (default: text)
-t, --timestamps Add timestamps to plain-text output
clean / summarize / pipeline options:
-m, --mode {brief,detailed,bullets,outline} Summary mode (default: brief)
pipeline options:
--skip-clean Skip paragraph cleaning step
--skip-summary Skip summarization step
Output Files (pipeline with -o)
When using pipeline -o ./output/, three files are saved per video:
./output/
VIDEO_ID_transcript.txt Raw transcript
VIDEO_ID_cleaned.txt Paragraph-cleaned transcript
VIDEO_ID_summary.txt Summary
Chunking Strategy
Transcripts larger than 60,000 characters are automatically split into chunks
at paragraph or sentence boundaries. Each chunk is processed independently,
then the partial results are merged in a final synthesis pass. This allows
the toolkit to handle full-length lecture recordings, long-form interviews,
and documentary transcripts without hitting token limits.
This tool uses YouTube's publicly accessible caption endpoint and the Anthropic
API for personal, educational, and research use. An Anthropic API key is required
for the clean and summarize features. Review YouTube's Terms of Service before
using this tool in a production or commercial context.