Vibe Coding

YTS - Summarise YouTube Videos with Claude AI from the Command Line

TL;DR

  • YTS is a single-file Python CLI that summarises any YouTube video in seconds
  • It downloads subtitles via yt-dlp, cleans them, and sends them to Claude AI for summarisation
  • Cuts through clickbait by directly answering the video title with key takeaways
  • Supports any Claude model and follows Unix conventions with clean stdout output
  • Open source and available on GitHub for anyone to use

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:

  1. Fetches the video metadata and title from YouTube
  2. Downloads the English subtitles (auto-generated or manual)
  3. Cleans the raw subtitle text by stripping timestamps, HTML tags, and duplicate lines
  4. Sends the cleaned transcript to Claude AI with a prompt designed to produce a useful summary
  5. 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

Get the Code

The project is open source and available on GitHub:

https://github.com/alexlaverty/yts

Comments (...)

Loading comments...