The primary goal of this project is to analyze a streamer's Twitch streams in real-time, save the analytics data to a database, and use an AI agent to query the data to improve viewer engagement. The main objectives include:
- Real-Time Data Collection: Collect data from Twitch streams, including viewer count, chat messages, and stream details.
- Data Storage: Store the collected data in a database for further analysis.
- Data Analysis: Analyze the data to identify patterns and insights that can help improve viewer engagement.
- AI Integration: Use an AI agent to query the data and provide recommendations for improving streams and reaching a wider audience.
- Web Interface: Develop a web interface to view live and historical data and interact with the AI agent.
-
Twitch Data Collection:
- Implemented a script to authenticate with the Twitch API and fetch live stream data.
- Set up a MongoDB database to store stream data, including game name, start time, comments, viewer count, and transcription.
-
Twitch Chat Integration:
- Developed a Twitch chat bot to connect to Twitch's IRC server and collect chat messages in real-time.
- Stored chat messages in MongoDB with timestamps.
-
Audio Transcription:
- Used FFmpeg to capture audio from Twitch streams.
- Implemented transcription using Google Cloud Speech-to-Text API.
- Stored transcriptions in MongoDB with timestamps.
-
Stream End Time Tracking:
- Implement logic to update the
end_time
field when a stream ends.
- Implement logic to update the
-
Web Interface Development:
- Create a web application to visualize live and historical data.
- Implement a chat interface to interact with the AI agent.
-
AI Integration:
- Set up an AI agent using OpenAI's API to query the database and provide insights.
-
Optimization and Testing:
- Optimize the data collection and analysis processes for performance and scalability.
- Test the system with real data to ensure accuracy and reliability.
To get started with the project, follow these steps:
- Set up a MongoDB database and update the connection details in the script.
- Replace placeholders with your actual Twitch and Google Cloud credentials.
- Run the scripts to start collecting data and storing it in the database.
- Python 3.x
- MongoDB
- FFmpeg
- Google Cloud Speech-to-Text API
- Twitch API credentials
Contributions are welcome! If you have any suggestions or improvements, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.