YTS - YouTube Video Summariser
Ever stared at a 45-minute YouTube video wondering if the actual answer to the title is buried somewhere in minute 37? YTS is a command-line tool that solves that problem. Give it a YouTube URL and it returns a structured summary of the video content in seconds.
You can grab the code here: github.com/alexlaverty/yts
What It Does
YTS automates a simple pipeline:
- Fetches the video metadata and title from YouTube
- Downloads the English subtitles (auto-generated or manual)
- Cleans the raw subtitle text by stripping timestamps, HTML tags, and duplicate lines
- Sends the cleaned transcript to Claude AI with a prompt designed to produce a useful summary
- Outputs a direct answer to the video title followed by bullet-point key takeaways
The result is a concise summary that cuts through clickbait and gets to the substance of the video.
Usage
python yts.py <youtube-url>
To use a specific Claude model:
python yts.py <youtube-url> -m claude-sonnet-4-5-20250929
By default it uses claude-haiku-4-5-20251001 for fast, cheap summaries.
How It Works
The tool is a single Python file (yts.py) with a clear separation of concerns:
Subtitle extraction uses yt-dlp as a Python library to download VTT-format subtitles without downloading the actual video. It looks for both auto-generated and manually uploaded English captions.
Subtitle cleaning strips out VTT headers, timestamps, position tags, HTML styling tags, and blank lines. It also deduplicates repeated lines that are common in auto-generated captions, then joins everything into a single clean block of text.
Summarisation calls the Claude Code CLI via subprocess, passing in the video title and cleaned transcript with a prompt that asks for a direct paragraph answer followed by key points. Status messages go to stderr while the final summary goes to stdout, following Unix conventions so you can pipe the output wherever you need it.
Transcript truncation kicks in automatically if the transcript exceeds 100,000 characters, keeping things within token limits.
Prerequisites
- Python 3.6+
- yt-dlp (
pip install yt-dlp) - Claude Code CLI installed and configured
Get the Code
The project is open source and available on GitHub:
Comments (...)
Please sign in to leave a comment.
Loading comments...