84 lines
3.6 KiB
Markdown
84 lines
3.6 KiB
Markdown
# YouTube Live Chat in Terminal
|
|
|
|
## Project Description
|
|
This project aims to provide a customizable way to view YouTube Live Chat directly in your terminal. It is implemented in `main.py`.
|
|
|
|
## Features
|
|
* **Real-time Live Chat Display:** Fetches and displays messages from YouTube Live Streams.
|
|
* **OAuth 2.0 Authentication:** Securely connects to your YouTube account to access your live stream data.
|
|
* **Terminal-based Interface:** View chat directly in your command-line interface.
|
|
|
|
### Planned Features
|
|
* Color-coded usernames for better readability.
|
|
* Customizable terminal output (e.g., font size, message formatting).
|
|
* Ability to send messages back to the live chat.
|
|
* Local web overlay for use with streaming software like OBS.
|
|
|
|
## Setup Instructions
|
|
|
|
### 1. Clone the Repository (Future Step)
|
|
Once this project is on GitHub, you would clone it using:
|
|
```bash
|
|
git clone [repository-url]
|
|
cd youtube_chat_terminal
|
|
```
|
|
|
|
### 2. Create and Activate a Python Virtual Environment
|
|
It's highly recommended to use a virtual environment to manage project dependencies.
|
|
|
|
```bash
|
|
cd /home/joe/Cloud9/Documents/Obisdian/youtube_chat_terminal
|
|
python3 -m venv venv
|
|
source venv/bin/activate
|
|
```
|
|
*(If you are using a shell like `fish` and encounter issues with `source venv/bin/activate`, try running `bash` first, then `source venv/bin/activate` within the bash session.)*
|
|
|
|
### 3. Install Dependencies
|
|
With your virtual environment activated, install the required Python libraries:
|
|
|
|
```bash
|
|
pip install google-api-python-client google-auth-oauthlib google-auth-httplib2 prompt_toolkit
|
|
```
|
|
|
|
### 4. Google Cloud Project Setup
|
|
To allow this application to access YouTube Live Chat data, you need to set up a project in the Google Cloud Console:
|
|
|
|
1. Go to the [Google Cloud Console](https://console.cloud.google.com/).
|
|
2. Create a new project or select an existing one.
|
|
3. Navigate to "APIs & Services" > "Library".
|
|
4. Search for and **enable the "YouTube Data API v3"**.
|
|
5. Go to "APIs & Services" > "Credentials".
|
|
6. Click "+ CREATE CREDENTIALS" and choose **"OAuth client ID"**.
|
|
7. For "Application type", select **"Desktop app"**.
|
|
8. Give it a name (e.g., "YouTube Chat Terminal App") and click "CREATE".
|
|
9. Download the JSON file containing your Client ID and Client Secret. Rename this file to `client_secret.json`.
|
|
|
|
### 5. Place `client_secret.json`
|
|
Move the downloaded `client_secret.json` file into the root directory of this project (i.e., `/home/joe/Cloud9/Documents/Obisdian/youtube_chat_terminal/`).
|
|
|
|
### 6. Initial Authentication
|
|
Run the `main.py` script for the first time to complete the OAuth 2.0 authentication flow:
|
|
|
|
```bash
|
|
python main.py
|
|
```
|
|
This will open a browser window, prompting you to log in with your Google account and grant permissions to the application. Upon successful authentication, a `token.json` file will be created in the project directory. This file stores your credentials for future use, so you won't need to re-authenticate every time.
|
|
|
|
## Usage
|
|
To view the live chat of a YouTube stream, run the script and provide the YouTube Live Stream Video ID when prompted:
|
|
|
|
```bash
|
|
python main.py
|
|
```
|
|
The script will then continuously fetch and display live chat messages in your terminal.
|
|
|
|
### Finding the YouTube Live Stream Video ID
|
|
* Go to the live stream on YouTube.
|
|
* The Video ID is the alphanumeric string in the URL after `v=` (e.g., in `https://www.youtube.com/watch?v=YOUR_VIDEO_ID`, `YOUR_VIDEO_ID` is the ID you need).
|
|
|
|
## Future Development
|
|
Contributions and suggestions are welcome! Planned enhancements include:
|
|
* Advanced terminal formatting and styling.
|
|
* Integration for sending chat messages.
|
|
* Development of a local web overlay.
|