90 lines
No EOL
3.3 KiB
Markdown
90 lines
No EOL
3.3 KiB
Markdown
# 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:
|
|
|
|
```sh
|
|
git clone https://git.zzls.xyz/Fijxu/TwitchToYoutube
|
|
```
|
|
|
|
The rest of this guide is separated in different parts
|
|
|
|
1. [Create a twitch application](#create-a-twitch-application)
|
|
2. [Get the twitch tokens](#get-twitch-tokens)
|
|
3. [Configure youtubeuploader](#configure-youtubeuploader)
|
|
4. [Run](#run)
|
|
|
|
## Create a twitch Application
|
|
|
|
- First you have to go to the [twitch devs page](https://dev.twitch.tv/).
|
|
- 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` and `CUSTOMER SECRET` with the values you saved
|
|
|
|
```sh
|
|
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 the `twitchauth` field of the `config.sh` file and in `clientid` put the client id you used before
|
|
|
|
## Configure youtubeuploader
|
|
|
|
- Download the latest release of [youtubeuploader](https://github.com/porjo/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
|
|
|
|
```sh
|
|
tar -xzvf youtubeuploader_22.04_Linux_x86_64.tar.gz
|
|
```
|
|
|
|
- Move the binary to the `~/.local/bin` folder
|
|
|
|
```sh
|
|
mv youtubeuploader ~/.local/bin
|
|
```
|
|
|
|
- Create the configuration folder
|
|
|
|
```sh
|
|
mkdir ~/.config/youtubeuploader
|
|
```
|
|
|
|
- Follow [these](https://github.com/porjo/youtubeuploader#Youtube-API) 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
|
|
|
|
```sh
|
|
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 the `twtoyt.sh` and `config.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 the `request.token` and `client_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
|
|
|
|
```sh
|
|
chmod +x twtoyt.sh
|
|
```
|
|
|
|
and run it with
|
|
|
|
```sh
|
|
./twtoyt.sh
|
|
``` |