StreamGuard is a Python script designed to analyze YouTube live chat streams and estimate the number of real viewers versus potential bot accounts. It collects live chat messages, analyzes chat activity patterns, and provides an estimation of viewer authenticity based on chat behavior.
- Automatically detects active YouTube live streams on a specified channel.
- Collects and analyzes live chat messages over a configurable time window.
- Detects suspicious chat activity indicating potential bots.
- Estimates real viewers and bots based on chat-to-viewer ratios.
- Logs analysis results in a JSON file for further inspection.
- Python 3.8 or later
- Google API Client Library for Python (
google-api-python-client
) - YouTube Data API v3 Key
To use this script, you need to obtain a YouTube Data API v3 key. Follow these steps:
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- Enable the YouTube Data API v3 under "APIs & Services".
- Navigate to "Credentials" and create an API key.
- Use this key in the
API_KEY
configuration of the script.
pip install google-api-python-client
- Clone the repository:
git clone https://github.com/Riotcoke123/StreamGuard-YouTube-Bot-Detection.git
- Set your YouTube Data API key and target channel ID in the script configuration.
- Run the script:
python yt.py
The main configuration parameters can be adjusted at the top of the script:
API_KEY
: Your YouTube Data API v3 key.CHANNEL_ID
: The YouTube channel ID to monitor.CHAT_COLLECTION_DURATION_SEC
: Duration in seconds to collect chat messages during each analysis.BOT_ESTIMATION_INTERVAL_SEC
: Time interval between bot detection runs.
This project is licensed under the GNU General Public License v3.0.
Find the project on GitHub: https://github.com/Riotcoke123/StreamGuard-YouTube-Bot-Detection
© 2025 StreamGuard Project. Licensed under GPLv3.