A Python command-line tool that downloads YouTube video transcripts and generates AI-powered summaries using LiteLLM.
- Download transcripts from YouTube videos
- Generate AI summaries using various LLM models (Claude, GPT, etc.)
- Save results to markdown files
- Interactive and command-line modes
- Configurable output files and models
This project uses uv for dependency management. Make sure you have uv installed first.
curl -LsSf https://astral.sh/uv/install.sh | sh# Clone or navigate to the project directory
cd youtubesummary
# Install dependencies and create virtual environment
uv sync
# Install the package in development mode
uv pip install -e .# Basic usage
uv run youtube-summary https://www.youtube.com/watch?v=VIDEO_ID
# Interactive mode (prompts for URL)
uv run youtube-summary
# Custom output file and model
uv run youtube-summary -o my_summary.md -m gpt-4 https://youtu.be/VIDEO_ID
# Help
uv run youtube-summary --help# Run directly with uv
uv run python -m youtubesummary.youtube_summary https://www.youtube.com/watch?v=VIDEO_ID
# Or activate the virtual environment first
source .venv/bin/activate # On Windows: .venv\Scripts\activate
python -m youtubesummary.youtube_summary https://www.youtube.com/watch?v=VIDEO_IDusage: youtube-summary [-h] [-o OUTPUT] [-m MODEL] [url]
Download YouTube video transcripts and generate AI summaries
positional arguments:
url YouTube video URL or video ID
options:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
Output markdown file (default: transcript.md)
-m MODEL, --model MODEL
LLM model to use for summary (default: claude-3-5-sonnet-20241022)
# Download and summarize a video
uv run youtube-summary https://www.youtube.com/watch?v=dQw4w9WgXcQ
# Use a different model
uv run youtube-summary -m gpt-4 https://youtu.be/dQw4w9WgXcQ
# Save to a custom file
uv run youtube-summary -o my_video_summary.md https://www.youtube.com/watch?v=dQw4w9WgXcQ
# Interactive mode
uv run youtube-summaryThe tool uses LiteLLM, which supports many model providers. You may need to set up API keys as environment variables:
# For Claude (Anthropic)
export ANTHROPIC_API_KEY=your_api_key
# For OpenAI
export OPENAI_API_KEY=your_api_key
# For other providers, check LiteLLM documentationThe tool creates a markdown file with:
- Video URL
- AI-generated summary at the top
- Full transcript below
# Install development dependencies
uv sync
# Run tests (if any)
uv run python -m pytest
# Format code
uv run python -m black .
# Type checking
uv run python -m mypy .