This tool creates comprehensive summaries of YouTube videos by analyzing their transcripts using the Gemini API.
- Fetches YouTube video transcripts
- Uses MapReduce pattern to process videos of any length
- Rate-limited API calls to stay within Gemini API quotas
- Smart chunking with sentence-based segmentation
- Creates well-structured summaries with key points
- Supports videos of any length, including multi-hour content
- Saves summaries as Markdown files
- Node.js 16+
- Gemini API key (get one at Google AI Studio)
- Clone this repository
- Install dependencies:
npm install - Create a
.envfile with your Gemini API key:
GEMINI_API_KEY=your_api_key_here
Run the tool with:
npm start
The tool will:
- Ask for your Gemini API key (if not in
.env) - Ask for the YouTube video URL
- Fetch and analyze the transcript
- Generate and save a summary
For videos over 1 hour long, you can use different modes to balance quality and processing time:
Processes up to 300K characters (~75K tokens) of transcript
npm start
Faster processing with intelligent sampling of very long transcripts
npm start -- --long-video
More comprehensive summaries by processing more content (up to 500K characters)
npm start -- --high-quality
When using --long-video, you can specify how the transcript is sampled:
--sample-intelligent(default): Takes 6 strategically placed samples throughout the video--sample-uniform: Takes equal samples from beginning, middle, and end--sample-bookend: Focuses more on beginning and end where key info often appears
Example:
npm start -- --long-video --sample-bookend
- Fetch & Validate: Gets the YouTube transcript and verifies it
- Chunk: Divides the transcript into manageable pieces
- Map: Summarizes each chunk in parallel (with rate limiting)
- Reduce: Combines chunk summaries into a cohesive final summary
- Format: Applies Markdown formatting for readability
The tool respects Gemini API free tier limits:
- 15 requests per minute
- 1,000,000 tokens per minute
- 1,500 requests per day
For long videos, processing automatically throttles to stay within these limits.
MIT