This project is a FastAPI application that summarizes YouTube comments using AI models. It fetches comments from YouTube, summarizes them, vectorizes the comments for similarity search, and allows users to query for specific information.
All main endpoints are HTMX endpoints and return rendered HTML templates, not raw JSON.
-
Clone the repository
git clone https://github.com/zodakzach/yt-comments-ai-analyzer.git cd yt-comments-ai-analyzer
-
Create a virtual environment and install dependencies with uv
uv venv source .venv/bin/activate # On Windows use `.venv\Scripts\activate` uv pip install -r pyproject.toml
-
Set up environment variables
- Copy
.env.example
to.env
and fill in the required variables:YOUTUBE_API_KEY
THREAD_OPENAI_API_KEY
UPSTASH_REDIS_REST_URL
UPSTASH_REDIS_REST_TOKEN
- Copy
-
Run the application
uvicorn app.main:app --reload
- The API provides HTMX endpoints that return HTML templates:
/summarize/
- Summarize YouTube comments and start a session (returns a summary template)./question/
- Ask a question about the summarized comments using your session (returns an answer template)./health
- Health check endpoint
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.