Skip to main content

Summarize YouTube videos using AI (OpenAI, Anthropic, or OpenRouter)

Project description

YouTube Summariser

A command-line tool that summarizes YouTube videos using AI. It extracts transcripts from YouTube videos and generates structured summaries using OpenAI, Anthropic, or OpenRouter (300+ models).

Installation

pip install youtube-summariser

Note: youtube-summariser (British), youtube-summarizer (American), and ys (short alias) commands are all available.

Or install from source:

git clone https://github.com/weijianzhg/youtube-summariser
cd youtube-summariser
pip install -e .

Quick Start

Run the interactive setup to configure your API keys:

youtube-summariser init

This guides you through:

  • Selecting your default provider (Anthropic, OpenAI, or OpenRouter)
  • Entering your API key (securely masked)
  • Optionally configuring additional providers

Configuration

Option 1: Interactive Setup (Recommended)

youtube-summariser init

Settings are saved to a platform-appropriate location:

  • macOS/Linux: ~/.youtube-summariser/config.yaml
  • Windows: %APPDATA%\youtube-summariser\config.yaml

Re-run init anytime to update your settings.

Option 2: Environment Variables

# For Anthropic (default provider)
export ANTHROPIC_API_KEY=your_anthropic_api_key

# For OpenAI
export OPENAI_API_KEY=your_openai_api_key

# For OpenRouter (access 300+ models)
export OPENROUTER_API_KEY=your_openrouter_api_key

Or create a .env file in your working directory.

Configuration Priority

  1. Environment variables (highest priority)
  2. User config file (~/.youtube-summariser/config.yaml)
  3. Bundled defaults

Default Provider

The default provider is Anthropic. You can change this via init or override per command using --provider.

Usage

# Interactive configuration
youtube-summariser init

# Same command with the short alias
ys init

# Summarize a video (saves to auto-generated filename)
youtube-summariser "https://www.youtube.com/watch?v=VIDEO_ID"

# Specify output filename
youtube-summariser "https://youtu.be/VIDEO_ID" -o my_summary.md

# Print to terminal only (no file saved)
youtube-summariser "https://youtube.com/watch?v=VIDEO_ID" --no-save

# Use a specific provider
youtube-summariser "https://youtu.be/VIDEO_ID" --provider openai

# Use OpenRouter with access to 300+ models
youtube-summariser "https://youtu.be/VIDEO_ID" --provider openrouter

Search by Title

Don't have a URL? Search for videos by title:

# Interactive selection (shows top 5 results)
youtube-summariser search "How to make mass"

# Auto-select first result
youtube-summariser search "Python tutorial" --first

# Show more results
youtube-summariser search "cooking recipes" --max-results 10

Commands

Command Description
init Interactive setup for API keys and preferences
summarise Summarize a YouTube video (also aliased as summarize)
search Search YouTube by title and summarize

You can also pass a URL directly without the summarise subcommand for convenience.

Options

Flag Description
-o, --output Specify output filename (default: YYYY-MM-DD__video-title-slug__video-id.md)
--no-save Print summary to terminal without saving to file
--provider LLM provider to use: openai, anthropic, or openrouter
--no-stream Disable streaming output
--first, -1 Auto-select first search result (search command only)
--max-results Number of search results to display (default: 5)
-v, --version Show version number
-h, --help Show help message

zsh Tip (URLs Without Quotes)

In zsh, unquoted YouTube URLs containing ? are treated as glob patterns before the CLI runs.

Use one of these approaches:

# Escape ? in the URL
ys https://www.youtube.com/watch\?v=VIDEO_ID

# Or disable globbing for this command
noglob ys https://www.youtube.com/watch?v=VIDEO_ID

To make this convenient permanently, add to ~/.zshrc:

ys() { noglob command ys "$@"; }

Output Format

Summary files are saved as markdown (.md) with the following structure:

# YouTube Video Summary

| | |
|---|---|
| **Video URL** | <https://www.youtube.com/watch?v=VIDEO_ID> |
| **Video ID** | `VIDEO_ID` |
| **Generated** | 2025-01-01 14:30:00 |
| **Model** | anthropic / claude-sonnet-4-5-20250929 |

---

## Main Topics
...

## Key Points
...

## Detailed Summary
...

## Notable Quotes
...

## Timestamps for Important Moments
...

Requirements

  • Python 3.10+
  • An API key for OpenAI, Anthropic, or OpenRouter

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

youtube_summariser-0.6.3.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

youtube_summariser-0.6.3-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file youtube_summariser-0.6.3.tar.gz.

File metadata

  • Download URL: youtube_summariser-0.6.3.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for youtube_summariser-0.6.3.tar.gz
Algorithm Hash digest
SHA256 e2a983621b4d8ec038c5c510b8b65c18d28f89d679dc3fc92e24820dda2fe61c
MD5 a7507b7ead81feda4271ac5b24edba89
BLAKE2b-256 92551750e94189cc41712f97d9816d1785c003ca306b65a71898d8fb16efb5c6

See more details on using hashes here.

File details

Details for the file youtube_summariser-0.6.3-py3-none-any.whl.

File metadata

File hashes

Hashes for youtube_summariser-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 eb9920272459f8ba7ec7e2e9bd3d26d35fc4d460b8c3eeb9848beb277acade33
MD5 7ea0c917ddc615d9f68aab9c1acd6d93
BLAKE2b-256 debde0368c7cbe1a0c08397aca285b4c5748cdcdf07940fc5aeb3a88515ec712

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page