2.1 KiB
Installation and Usage Instructions
This document provides detailed instructions for setting up and running the pytchat_listener.py script for monitoring YouTube Live Chat.
Prerequisites
- Python 3.8+
pip(Python package installer)git(for cloning the repository)
Installation Steps
-
Clone the Repository: Open your terminal and clone the project repository from Gitea:
git clone https://gitea.ramforth.net/ramforth/youtube-chat-webhook-v2.git cd youtube-chat-webhook-v2 -
Create and Activate a Virtual Environment: It is highly recommended to use a Python virtual environment to manage project dependencies.
python3 -m venv venv- For Bash/Zsh:
source venv/bin/activate - For Fish Shell:
source venv/bin/activate.fish
- For Bash/Zsh:
-
Install Dependencies: With your virtual environment activated, install the required Python packages:
pip install pytchat rich
Usage
-
Run the Script: Ensure your virtual environment is activated, then run the
pytchat_listener.pyscript:python pytchat_listener.py -
Enter Video ID: The script will prompt you to "Enter the YouTube Live Stream Video ID:". Paste the 11-character ID of the live stream you wish to monitor and press Enter.
-
Observe Chat: The script will then start fetching and displaying live chat messages in your terminal.
-
Save Chat Log: To exit the script gracefully, press
Ctrl+C. You will then be prompted if you want to save the chat log.
User Colors Persistence (user_colors.json)
The script assigns unique, persistent colors to chatters. This mapping is stored in a file named user_colors.json in the project directory.
- If this file does not exist, it will be created automatically.
- If it exists, the script will load the previously assigned colors.
- You can manually edit this file to change a user's color or reset the mapping.