An AI-powered command-line tool that transcribes YouTube videos, generates detailed hierarchical summaries and keywords using Google Gemini, stores them locally as Markdown, indexes them in a FAISS vector database for semantic search, and syncs everything to a Notion database.
- Automatic Transcription: Fetches transcripts directly from YouTube IDs.
- AI Summarization: Uses Google Gemini (with fallbacks to multiple models and local Ollama) to generate detailed, structured summaries and relevant keywords.
- Local Storage: Saves every summary as a clean Markdown file in a dedicated
summaries/directory. - Semantic Vector Search: Indexes all summaries using FAISS and Gemini embeddings, allowing you to search through your video library by meaning, not just keywords.
- Notion Integration: Automatically syncs summaries, URLs, and keywords to a structured Notion database for easy browsing and organization.
- Python 3.8+
- Google Gemini API Key: Get one here
- Notion Integration Token & Database ID: Setup guide
-
Clone the repository:
git clone https://github.com/your-username/YouTubeSummary.git cd YouTubeSummary -
Install dependencies:
pip install -r requirements.txt
-
Configure Environment Variables: Create a
.envfile in the root directory and add your credentials:# API Keys GOOGLE_API_KEY=your_google_gemini_api_key NOTION_TOKEN=your_notion_integration_token NOTION_DATABASE_ID=your_notion_database_id # Model Configuration (Optional Defaults) MODEL_PRIMARY=gemini-3.1-pro-preview MODEL_FALLBACK_1=gemini-3.1-flash-preview MODEL_FALLBACK_2=gemini-3.1-flash-lite-preview # Local LLM Fallback (Optional - requires Ollama) LOCAL_LLM_URL=http://localhost:11434 LOCAL_MODEL=qwen3:8b
The tool is accessible via the main.py CLI.
Generate a summary, index the vector data, and sync it to Notion.
python main.py add "https://www.youtube.com/watch?v=VIDEO_ID" --title "My Custom Title"Find videos by querying concepts or topics discussed in your saved summaries.
python main.py search "Explain how Transformers work in AI"main.py: Entry point for the CLI (Add/Search).summarizer.py: Logic for fetching transcripts and prompting the LLM for summaries.llm_client.py: Wrapper for Gemini API and local LLM fallbacks.search.py: Manages the FAISS index and vector search functionality.notion_sync.py: Handles the Notion API integration.storage.py: Simple utility for saving Markdown files.summaries/: Local directory where generated summaries are stored.
Feel free to open issues or submit pull requests for any improvements or bug fixes!