# YouTube Summarizer Web Application An AI-powered web application that automatically extracts, transcribes, and summarizes YouTube videos, providing intelligent insights and key takeaways. ## ๐ŸŽฏ Features - **Video Transcript Extraction**: Automatically fetch transcripts from YouTube videos - **AI-Powered Summarization**: Generate concise summaries using multiple AI models - **Multi-Model Support**: Choose between OpenAI GPT, Anthropic Claude, or DeepSeek - **Key Points Extraction**: Identify and highlight main topics and insights - **Chapter Generation**: Automatically create timestamped chapters - **Export Options**: Save summaries as Markdown, PDF, or plain text - **Caching System**: Reduce API calls with intelligent caching - **Rate Limiting**: Built-in protection against API overuse ## ๐Ÿ—๏ธ Architecture ``` [Web Interface] โ†’ [FastAPI Backend] โ†’ [YouTube API/Transcript API] โ†“ [AI Service] โ† [Summary Generation] โ† [Transcript Processing] โ†“ [Database Cache] โ†’ [Summary Storage] โ†’ [Export Service] ``` ## ๐Ÿš€ Quick Start ### Prerequisites - Python 3.11+ - YouTube API Key (optional but recommended) - At least one AI service API key (OpenAI, Anthropic, or DeepSeek) ### Installation 1. **Clone the repository** ```bash git clone https://eniasgit.zeabur.app/demo/youtube-summarizer.git cd youtube-summarizer ``` 2. **Set up virtual environment** ```bash python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` 3. **Install dependencies** ```bash pip install -r requirements.txt ``` 4. **Configure environment** ```bash cp .env.example .env # Edit .env with your API keys and configuration ``` 5. **Initialize database** ```bash alembic init alembic alembic revision --autogenerate -m "Initial migration" alembic upgrade head ``` 6. **Run the application** ```bash python src/main.py ``` The application will be available at `http://localhost:8082` ## ๐Ÿ“ Project Structure ``` youtube-summarizer/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ api/ # API endpoints โ”‚ โ”‚ โ”œโ”€โ”€ routes.py # Main API routes โ”‚ โ”‚ โ””โ”€โ”€ websocket.py # Real-time updates โ”‚ โ”œโ”€โ”€ services/ # Business logic โ”‚ โ”‚ โ”œโ”€โ”€ youtube.py # YouTube integration โ”‚ โ”‚ โ”œโ”€โ”€ summarizer.py # AI summarization โ”‚ โ”‚ โ””โ”€โ”€ cache.py # Caching service โ”‚ โ”œโ”€โ”€ utils/ # Utility functions โ”‚ โ”‚ โ”œโ”€โ”€ validators.py # Input validation โ”‚ โ”‚ โ””โ”€โ”€ formatters.py # Output formatting โ”‚ โ””โ”€โ”€ main.py # Application entry point โ”œโ”€โ”€ tests/ # Test suite โ”œโ”€โ”€ docs/ # Documentation โ”œโ”€โ”€ alembic/ # Database migrations โ”œโ”€โ”€ static/ # Frontend assets โ”œโ”€โ”€ templates/ # HTML templates โ”œโ”€โ”€ requirements.txt # Python dependencies โ”œโ”€โ”€ .env.example # Environment template โ””โ”€โ”€ README.md # This file ``` ## ๐Ÿ”ง Configuration ### Essential Environment Variables | Variable | Description | Required | |----------|-------------|----------| | `YOUTUBE_API_KEY` | YouTube Data API v3 key | Optional* | | `OPENAI_API_KEY` | OpenAI API key | One of these | | `ANTHROPIC_API_KEY` | Anthropic Claude API key | is required | | `DEEPSEEK_API_KEY` | DeepSeek API key | for AI | | `DATABASE_URL` | Database connection string | Yes | | `SECRET_KEY` | Session secret key | Yes | *YouTube API key improves metadata fetching but transcript extraction works without it. ## ๐Ÿงช Testing Run the test suite: ```bash pytest tests/ -v pytest tests/ --cov=src --cov-report=html # With coverage ``` ## ๐Ÿ“ API Documentation Once running, visit: - Interactive API docs: `http://localhost:8082/docs` - Alternative docs: `http://localhost:8082/redoc` ### Key Endpoints - `POST /api/summarize` - Submit a YouTube URL for summarization - `GET /api/summary/{id}` - Retrieve a summary - `GET /api/summaries` - List all summaries - `POST /api/export/{id}` - Export summary in different formats ## ๐Ÿšข Deployment ### Docker ```bash docker build -t youtube-summarizer . docker run -p 8082:8082 --env-file .env youtube-summarizer ``` ### Production Considerations 1. Use PostgreSQL instead of SQLite for production 2. Configure proper CORS settings 3. Set up SSL/TLS certificates 4. Implement user authentication 5. Configure rate limiting per user 6. Set up monitoring and logging ## ๐Ÿค Contributing 1. Fork the repository 2. Create a feature branch 3. Commit your changes 4. Push to the branch 5. Create a Pull Request ## ๐Ÿ“„ License This project is part of the Personal AI Assistant ecosystem. ## ๐Ÿ”— Related Projects - [Personal AI Assistant](https://eniasgit.zeabur.app/demo/my-ai-projects) - [YouTube Automation Service](https://eniasgit.zeabur.app/demo/youtube-automation) - [PDF Translator](https://eniasgit.zeabur.app/demo/pdf-translator) ## ๐Ÿ“ž Support For issues and questions, please create an issue in the repository.