Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Riotcoke123/StreamGuard-YouTube-Bot-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StreamGuard - YouTube Bot Detection

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.

Features

  • 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.
  • Immediate GUI popup: The graphical interface launches instantly without waiting for data fetching.
  • Background data loading: Channel info and stream statistics load asynchronously in separate threads, ensuring a responsive UI.

Requirements

  • Python 3.8 or later
  • Google API Client Library for Python (google-api-python-client)
  • YouTube Data API v3 Key
  • Additional dependencies: requests, Pillow (PIL fork)

Getting a YouTube Data API Key

To use this script, you need to obtain a YouTube Data API v3 key. Follow these steps:

  1. Go to the Google Cloud Console.
  2. Create a new project or select an existing one.
  3. Enable the YouTube Data API v3 under "APIs & Services".
  4. Navigate to "Credentials" and create an API key.
  5. Use this key in the API_KEY configuration of the script.

Installation

pip install google-api-python-client requests Pillow

Usage

  1. Clone the repository:
    git clone https://github.com/Riotcoke123/StreamGuard-YouTube-Bot-Detection.git
  2. Set your YouTube Data API key and target channel ID in the script configuration.
  3. Run the script:
    python yt.py

Configuration

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_DURATION: Duration (seconds) to collect chat messages during each analysis cycle.
  • INTERVAL: Time interval (seconds) between consecutive bot detection runs.

Implementation Details

The updated script now:

  • Launches the GUI window immediately on start without delay.
  • Loads channel thumbnail and name in a background thread, updating the interface once available.
  • Runs the live chat analysis and viewer estimation in a background thread, logging results and updating the GUI asynchronously.
  • Uses threading.Thread and Tkinter's root.after() to safely update UI from background threads.

License

This project is licensed under the GNU General Public License v3.0.

Repository

Find the project on GitHub: https://github.com/Riotcoke123/StreamGuard-YouTube-Bot-Detection

© 2025 StreamGuard Project. Licensed under GPLv3.

Releases

No releases published

Packages

No packages published

Languages