youtube-summarizer/README.md

173 lines
5.0 KiB
Markdown

# 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.