An AI-powered application that transforms YouTube videos into searchable, interactive knowledge sources through advanced Large Language Models (LLMs).
YouTube Transcript Q&A & Summarizer is a modular, end-to-end pipeline that:
- Retrieves transcripts from YouTube videos automatically
- Dynamically chunks long content for optimal LLM processing
- Offers a Streamlit web interface for seamless user experience
- Transforms videos into searchable, interactive knowledge sources
Here is a visual overview of the application's pipeline, from user input to final output.
graph TD
subgraph "User Interface (Streamlit)"
A[User provides YouTube URL] --> B{Streamlit App};
end
subgraph "Backend Processing Pipeline"
B --> C[Transcript Retriever];
C -->|Raw Transcript| D[Preprocessor];
D -->|Cleaned Text| E[Dynamic Chunker];
E -->|Text Chunks| F[QA Engine];
F -->|Map: Process each chunk| G((LLM API));
G -->|Chunk Answers| F;
F -->|Reduce: Synthesize final answer| G;
end
subgraph "Final Output"
G -->|Unified Answer/Summary| B;
B --> H[Display to User];
H --> I[Download Output];
end
style F fill:##bbb,stroke:#333,stroke-width:2px
style G fill:#fff,stroke:#333,stroke-width:2px
Extracts subtitles automatically from YouTube videos with available captions.
Converts long video transcripts into concise, informative summaries using Google Gemini API.
Enter natural language queries and get accurate answers based on video content.
Efficiently processes long videos by chunking content and combining answers or summaries.
Simple, interactive user interface to upload links, ask questions, and view results.
Export generated summaries or answers as .txt
files for offline use.
Unit-tested modular pipeline using pytest with comprehensive coverage.
Centralized logging system with graceful failure mechanisms and detailed error tracking.
project-root/
โโโ app.py # Streamlit frontend
โโโ yt_logo.png # Logo for branding
โโโ requirements.txt # Dependencies
โโโ requirements-dev.txt # Dev dependencies (pytest, etc.)
โโโ pytest.ini # Pytest configuration
โโโ .env # API keys and configs (not committed)
โโโ .gitignore # Git ignore rules
โโโ README.md # Project documentation
โโโ setup.py # For packaging , still to launch but made it
โโโ logs/ # Runtime logs
โโโ src/
โ โโโ init.py
โ โโโ components/
โ โ โโโ init.py
โ โ โโโ main.py # Main orchestrator
โ โ โโโ preprocessor.py # Text cleaning & chunking
โ โ โโโ qa_engine.py # LLM interface
โ โ โโโ transcript_retriever.py # YouTube transcript fetching
โ โ โโโ internalTesting/ # Optional submodules
โ โโโ logger.py # Centralized logging
โ โโโ exception.py # Custom error handling
โ โโโ utils.py # Helper utilities
โโโ tests/
โโโ test_preprocessor.py
โโโ test_qa_engine.py
โโโ test_transcript_retriever.py
- Python 3.8+
- YouTube video with captions
- Google Gemini API key (or any supported LLM)
- Internet connection for API calls
git clone https://github.com/siddhamapple/YoutubeSummarizer
cd YoutubeSummarizer
python -m venv venv
Activate (Linux/Mac)
source venv/bin/activate
Activate WIndows
venv\Scripts\activate
For regular usage-
pip install -r requirements.txt
For development (includes testing tools)-
pip install -r requirements-dev.txt
Create a .env
file in the project root:
GEMINI_API_KEY=your_gemini_api_key_here
streamlit run app.py
Visit: http://localhost:8501
- Paste YouTube Link โ Enter any YouTube video URL
- Choose Mode โ Select "Summarize" or "Ask a Question"
- Process Transcript โ App fetches and processes video transcript
- LLM Processing โ AI runs on each chunk (Map-Reduce approach)
- View Results โ Final answer/summary displayed
- Download โ Optional: Save output as
.txt
file
Execute the complete test suite:
pytest
The testing suite covers:
- โ TranscriptRetriever: Verifies transcript fetch accuracy from YouTube
- โ Preprocessor: Validates chunking, cleaning, and formatting logic
- โ QnAEngine: Checks consistency and quality of LLM-generated answers/summaries
tests/
โโโ test_preprocessor.py
โโโ test_qa_engine.py
โโโ test_transcript_retriever.py
Tool/Library | Description |
---|---|
Streamlit | Frontend UI for interacting with the app |
Google Gemini API | Large Language Model for Q&A and summarization |
python-dotenv | Manages .env configurations securely |
Pytest | Testing framework for backend logic verification |
Custom Modules | Modular Python architecture under src/components/ |
transcript_retriever.py
: Fetches captions from YouTube videospreprocessor.py
: Cleans and chunks transcript contentqa_engine.py
: Interfaces with LLM for Q&A/summariesmain.py
: Orchestrates the entire pipeline
- ๐ Multilingual Support: Auto-detect video language and translate
- โก Asynchronous Processing: Faster summarization with async LLM calls
- โ๏ธ Deployment Options: Push to Streamlit Cloud / Hugging Face Spaces
- โจ๏ธ CLI Utilities: Command-line support for batch summarization
- ๐จ UI Polish: Improve layout, theme, and mobile responsiveness
- ๐ Analytics: Usage tracking and performance metrics
Siddham Jain
๐ B.Tech in Electrical and Computer Engineering | Shiv Nadar IOE
๐ง siddhamjainn@gmail.com
๐ฑ +919625208689
We welcome contributions! Follow these steps:
- Fork this repository
- Create a new feature branch (
git checkout -b feature-name
) - Commit your changes (
git commit -am 'Add feature'
) - Push to the branch (
git push origin feature-name
) - Open a pull request ๐
- Follow PEP 8 style guidelines
- Write comprehensive tests for new features
- Update documentation for any API changes
- Use only meaningful commit messages
โญ If you find this project helpful, please give it a star!
For questions, issues, or feature requests, please open an issue on GitHub.