Skip to content

maddox05/Comment-Game-Controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Comment Game Controller 🎮

Plays games from live stream user comments!

Python script to control games using YouTube and TikTok comments

DescriptionPrerequisitesImportant InformationSetupHow To UseContributingLicenseDisclaimer

Description

This Python script allows you to control games, such as Pokémon, using comments from YouTube and TikTok videos. It captures the comments from both platforms and maps them to keypresses that are then used to control the game.

Prerequisites

To clone and run this application, you'll need -

  • Python 3.6 or higher
  • keyboard library

pip install keyboard

  • TikTokLive library

pip install TikTokLive

  • pytchat library

pip install pytchat

Important Information

  • The script uses the keyboard library to simulate keypresses. Ensure that the game you want to control is compatible with keypress inputs.

  • The script utilizes the TikTokLive library to capture TikTok comments and the pytchat library to capture YouTube comments.

  • Comments containing the specified key events ("up", "down", "left", "right", "a", "b") will be detected and used for game control.

Setup

  1. Clone the repository or download the script file to your local machine.

git clone https://github.com/maddox05/Comment-Game-Controller.git

  1. Install the required libraries using the commands mentioned in the "Prerequisites" section.

How To Use

  1. Run the script using the command python game_controller.py

  2. If you want to use comments from

    • TikTok -

      • Obtain the TikTok username that you want to use for the live comments. Enter it when prompted by the script.
    • YouTube -

      • Provide the URL of the YouTube video (End ID) that you want to capture comments from. Enter it when prompted by the script.
  3. The script will start capturing comments from chosen platforms.

  4. Whenever a comment containing a specific key event (e.g., "up", "down", "left", "right", "a", "b") is detected, the corresponding key will be simulated as a keypress.

  5. The simulated keypress will be sent to the game, allowing you to control it using the comments.

  6. The script will display the name of the user and the comment for each detected key event.

Note: Make sure the game window is active and in focus while running the script for the keypresses to be recognized correctly.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

Apache License 2.0

Disclaimer

This script is provided as-is, without any warranty or guarantee. Use it at your own risk. The author is not responsible for any damages or consequences caused by using this script.

Note: Please ensure that you comply with the terms of service of YouTube and TikTok when using this script.


GitHub @maddox05