Skip to content

RichardHan/gemini-youtube-summary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YouTube Video Summarizer with Gemini API

A Python tool that uses Google's Gemini API to automatically summarize YouTube videos.

Features

  • 🎥 Summarize any YouTube video using AI
  • 🌐 Multi-language support (Chinese, Spanish, French, etc.)
  • 🚀 Support for multiple Gemini models
  • 🎨 Beautiful CLI output with progress indicators
  • 💾 Save summaries to file
  • 🔧 Custom prompt support
  • 🔐 Environment variable support for API keys

Setup

  1. Install dependencies:
pip install -r requirements.txt
  1. Set up your Gemini API key:
    • Copy .env.example to .env
    • Add your Gemini API key to the .env file
    • Or set it as an environment variable: export GEMINI_API_KEY=your_key_here

Usage

Basic usage:

python youtube_summarizer.py "https://www.youtube.com/watch?v=VIDEO_ID"

With custom prompt:

python youtube_summarizer.py "https://www.youtube.com/watch?v=VIDEO_ID" --prompt "Summarize this video in 3 bullet points"

Save to file:

python youtube_summarizer.py "https://www.youtube.com/watch?v=VIDEO_ID" -o summary.txt

Use different model:

python youtube_summarizer.py "https://www.youtube.com/watch?v=VIDEO_ID" --model gemini-2.5-flash

Summarize in different languages:

# Chinese
python youtube_summarizer.py "https://www.youtube.com/watch?v=VIDEO_ID" --lang zh
python youtube_summarizer.py "https://www.youtube.com/watch?v=VIDEO_ID" --lang chinese

# Spanish
python youtube_summarizer.py "https://www.youtube.com/watch?v=VIDEO_ID" --lang spanish

# French
python youtube_summarizer.py "https://www.youtube.com/watch?v=VIDEO_ID" -l fr

With API key flag:

python youtube_summarizer.py "https://www.youtube.com/watch?v=VIDEO_ID" --api-key YOUR_API_KEY

Examples

  1. Summarize a tech tutorial:
python youtube_summarizer.py "https://www.youtube.com/watch?v=dQw4w9WgXcQ" \
  --prompt "Extract the main steps and technical concepts from this tutorial"
  1. Get key takeaways from a lecture:
python youtube_summarizer.py "https://youtu.be/VIDEO_ID" \
  --prompt "List the main concepts discussed and any important definitions"
  1. Create study notes:
python youtube_summarizer.py "https://youtube.com/watch?v=VIDEO_ID" \
  --prompt "Create detailed study notes with headings and bullet points" \
  -o lecture_notes.txt
  1. Get summary in Chinese:
python youtube_summarizer.py "https://youtube.com/watch?v=VIDEO_ID" \
  --lang zh \
  -o chinese_summary.txt
  1. Combine custom prompt with language:
python youtube_summarizer.py "https://youtube.com/watch?v=VIDEO_ID" \
  --lang chinese \
  --prompt "用三个要点总结这个视频的核心内容"

Supported URL Formats

  • https://www.youtube.com/watch?v=VIDEO_ID
  • https://youtu.be/VIDEO_ID
  • https://youtube.com/watch?v=VIDEO_ID&t=123s
  • https://www.youtube.com/embed/VIDEO_ID

Supported Languages

The tool supports multiple output languages. Use the --lang or -l flag:

  • Chinese: zh, cn, chinese
  • English: en, english (default)
  • Spanish: es, spanish
  • French: fr, french
  • German: de, german
  • Japanese: ja, japanese
  • Korean: ko, korean
  • Or specify any other language by name

Requirements

  • Python 3.8+
  • Valid Gemini API key
  • Internet connection

Notes

  • The tool uses gemini-2.5-flash model by default (fast and efficient)
  • For more detailed summaries, you can specify different models with --model flag
  • API usage is subject to Google's rate limits and pricing

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages