A tool to analyze Twitch VOD chat activity and identify message frequency peaks and their preceding quiet periods.
-
Clone this repository:
git clone https://github.com/Digz0/TwitchPeakAnalyzer.git cd TwitchPeakAnalyzer -
Create and activate a virtual environment (recommended):
python -m venv .venv source .venv/bin/activate # On Windows use: .venv\Scripts\activate -
Install the required dependencies:
pip install -r requirements.txt
-
Use the
chat-downloaderto download Twitch chat data:chat_downloader https://www.twitch.tv/videos/YOUR_VIDEO_ID --output chat_data.json -
Run the TwitchPeakAnalyzer:
python twitch_analyzer.py -f chat_data.jsonThis will generate a
slopes_data.jsonfile for the browser extension. -
Copy the generated
slopes_data.jsonfile to the browser extension directory. -
Load the browser extension:
- Open Chrome and go to
chrome://extensions/ - Enable "Developer mode"
- Click "Load unpacked" and select the extension directory (containing manifest.json)
- Note: This extension uses Manifest V3
- Open Chrome and go to
-
Navigate to the Twitch VOD page. The extension will automatically load chat peaks.
-
While watching the VOD:
- Press 'Enter' to jump to the next peak.
- An on-screen notification will appear when you're in a peak window.
-wor--window: Set the time window size in seconds (default: 4)-nor--num_top_windows: Set the number of top message frequency windows to analyze (default: 50)--generate-image: Generate chat activity analysis image (optional)-lor--lookback: Set the lookback time in seconds for finding quiet periods (default: 60)
Example with custom window size and more peaks:
python twitch_analyzer.py -f chat_data.json -w 8 -n 75 --generate-image -l 120
The analyzer will:
- Find windows with peak message activity
- For each peak, find the quietest period within the lookback window
- Generate slopes_data.json containing these peaks and their preceding quiet periods
- Optionally generate a visualization as chat_activity_analysis.png
- Difference: Calculates the absolute change in message frequency between time windows.
- Ratio: Calculates the relative change in message frequency between time windows. This can be useful for detecting significant relative changes, especially in less active chats.
- Python 3.7+
- Chrome browser (for the extension)
To run the tests:
python -m unittest test_twitch_analyzer.py
This project is licensed under the MIT License - see the LICENSE file for details.