A Streamlit application that enables users to chat with the content of YouTube videos using AI. This tool automatically extracts video transcripts and uses OpenAI to answer questions about the video content.
- Extract transcripts directly from YouTube videos
- Chat with AI about the video content
- Maintain conversation history
- View raw transcript data
- Review OpenAI API interactions
- Clean, user-friendly interface
- Streamlit: For the web interface
- Playwright: For browser automation and transcript extraction
- OpenAI API: For AI-powered conversations
- Hyperbrowser: For managing browser sessions
- Python: Core programming language
- Python 3.7+
- OpenAI API key
- Hyperbrowser API key
-
Clone this repository:
git clone git@github.com:hyperbrowserai/examples.git cd chat-with/chat-with-youtube-video -
Install required dependencies:
pip install . -
Create a
.envfile in the root directory with the following variables:OPENAI_API_KEY=your_openai_api_key HYPERBROWSER_API_KEY=your_hyperbrowser_api_key
-
Start the Streamlit application:
streamlit run main.py
-
Open your web browser and navigate to the URL provided by Streamlit (typically http://localhost:8501)
-
Enter a YouTube video URL in the input field
-
Ask questions about the video content in the chat interface
- Playwright navigates to the video page and extracts the transcript
- The transcript is processed and stored in the session state
- When you ask a question, the application sends both the transcript and your question to OpenAI
- The AI generates a response based on the video content
- The conversation history is maintained for context in future questions
- The application requires videos to have available transcripts on YouTube
- AI responses are limited to the information available in the transcript
- The quality of responses depends on the accuracy and completeness of the transcript
