3.3 KiB
How to use it
This code only works for Linux, and maybe for MacOs.
First of all clone the repo (you have to have git
installed) with:
git clone https://git.zzls.xyz/Fijxu/TwitchToYoutube
The rest of this guide is separated in different parts
Create a twitch Application
- First you have to go to the twitch devs page.
- Click on
Log in with Twitch
on the top right. - After accepting click on
Your console
. - Click on
Register your application
. - In url you have to put
http://localhost
, the rest is not important. - Click on
Create
. - Then click on the button next to the application that says
Manage
. - They save the field that says
Customer ID
and create a new customer secret, they also save it for the following steps
Get the twitch tokens
- With the tokens we saved earlier, run this command replacing
CUSTOMER ID
andCUSTOMER SECRET
with the values you saved
curl --request POST 'https://id.twitch.tv/oauth2/token' \
--header 'Content-Type: application/json' \
--data-raw '{
"client_id": "CLIENT ID",
"client_secret": "CLIENT SECRET",
"grant_type": "client_credentials"
}'
- you will get something like
{"access_token": "TOKEN",...}
, that access_token is the one you have to put in thetwitchauth
field of theconfig.sh
file and inclientid
put the client id you used before
Configure youtubeuploader
-
Download the latest release of youtubeuploader for your system. (unless you have linux on a mac or something weird, you have to download the one ending with Linux_x86_64.tar.gz )
-
Unzip the downloaded file
tar -xzvf youtubeuploader_22.04_Linux_x86_64.tar.gz
- Move the binary to the
~/.local/bin
folder
mv youtubeuploader ~/.local/bin
- Create the configuration folder
mkdir ~/.config/youtubeuploader
-
Follow these instructions and save the
client_secrets.json
file in the~/.config/youtubeuploader/
folder we created before (don't forget to add the account you want to use for uploading videos as test user) -
The
youtubeuploader
tool is not fully polished and for it to work you have to first try to upload a video to youtube with it. The browser opens and you have to authorize the application with the same account you added in the previous step (the video is uploaded in private by default). -
To do that, run this command, change
yourVideo
for the name of the video you want to upload
youtubeuploader -filename yourVideo.mp4
- It will generate a
request.token
file in the current directory, save it in the folder of this repo together with thetwtoyt.sh
andconfig.sh
files. If you want to use it on a server where you don't have a monitor (99% of the cases) you will have to copy therequest.token
andclient_secrets.json
files to the server in the corresponding folders.
Execute
With this you should now have everything you need to run the script, simply give the script run permissions with
chmod +x twtoyt.sh
and run it with
./twtoyt.sh