Welcome to the Twitch Highlights Bot!
This Python bot utilizes the Twitch API to retrieve the most viewed clips from a selected game of the week, creates a video compilation of these clips using MoviePy, and then uploads the compilation to YouTube with an automatically generated title, description, and thumbnail. With this bot, you can easily keep up with the most popular clips on Twitch and share them with others on YouTube.
Here is the Youtube channel that I set up to test this bot.
Before you begin, ensure you have met the following requirements:
If you need help getting credentials from Twitch or Google, you may check the following guides:
Clone this repository:
git clone https://github.com/viniciusenari/automated-twitch-clips-youtube-channel
Create a virtual environment and install the requirements:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Create a .env file and add the following variables:
CLIENT_SECRET = "your_twitch_client_secret"
CLIENT_ID = "your_twitch_client_id"
Create a client_secret.json file and add the credentials from Google Cloud. You can download this from the Google Cloud Console under the credentials tab. Make sure to rename the file to client_secret.json.
The configuration file, config.py, is located in the project folder. In this file, you can change the fonts by specifying their file path. You can also change the rendering settings for the video compilation. You can check what each parameter does in the MoviePy documentation.
To run the bot, open the terminal and navigate to the main.py file's directory. Then type the following command:
python main.py --game <game_name> --amount <amount> --languages <languages>
Replace <game_name>
with the name of the game you want to use the bot for, <amount>
with the number of clips you want to generate, and <languages>
with a list of languages separated by spaces (e.g., "en fr de" for English, French, and German).
For example, if you want to generate ten clips for the game "League of Legends" in English and Brazilian Portuguese, you would use the following command:
python main.py --game "League of Legends" --amount 10 --languages en pt-br
You may also use the short versions of the arguments:
python main.py -g "League of Legends" -a 10 -l en pt-br
You'll see logs in the terminal as the bot runs. A progress bar will also show how much of the video has been rendered.
To upload your rendered video to YouTube, follow these steps:
Note that the downloaded and created files will be in the folder files
. The folder structure is as follows:
files
├── clips
├── overlays
├── thumbnails
└── youtube
The clips
folder holds the downloaded Twitch clips, the overlays
folder has the text overlays for each clip, the thumbnails
folder has the thumbnails for each clip, and the youtube
folder contains the video compilation and its thumbnail
If you want to contribute to this project, follow these steps:
git checkout -b <branch_name>
.git commit -m '<commit_message>'
git push origin <project_name>/<location>
Alternatively, see the GitHub documentation on creating a pull request.
If you want to propose changes to this project, follow these steps:
Alternatively, see the GitHub documentation on creating an issue.
If you want to report a bug to this project, follow these steps:
Alternatively, see the GitHub documentation on creating an issue.
Here are some ideas for contributions:
The code for this bot is licensed under the GPL-3.0 License.