Project for recording twitch.tv streams
This project was created in order to streamline the recording of Twitch.tv streams. To do so I have added the following features.
- Raw recordings can be divided into hour-long segments via
split_files.sh
- The entire project can be run on a standalone Vagrant box.
- Vagrant will install an isolated server with the required libraries. From there all you have to do is run the recorder. (directions below)
- Usernames: Place the twitch usernames for the streams you wish to record in
usernames.txt
. Each username belongs on a separate line. - Client ID: Create a twitch ClientID.
- Follow these directions https://blog.twitch.tv/client-id-required-for-kraken-api-calls-afbb8e95f843
- Modify
record.py
line #95clientId
by replacingxxxxxxxxxxx...
with your Client ID - OAuth Token: You will also need an OAuth token.
- A token can be retrieved from http://www.twitchapps.com/tmi/ .
- Modify
record.py
line #96oauthToken
by replacingxxxxxxxxxxx...
with the key (do not include the oauth part).
Recording streams: In order to record streams simply execute the following bash command from the project folder /bin/bash record_twitch.sh
Splitting long recordings: To divide long recordings into hour-long segments run the following bash command from the project folder /bin/bash split_files.sh
https://www.vagrantup.com/docs/getting-started/
The entire project can be run from a standalone vagrant server. The purpose of this was for portability and ease of use. Vagrant allows anyone to run this code regardless of operating system or existing system configurations. Furthermore since this can be run from any machine with vagrant installed, users can create and destroy twitch-recorder instances as they see fit.
- Install Vagrant
- From the project directory run the following command
vagrant up
. This will build a Centos7 server with the required python and livestreamer libraries - Log into the Vagrant machine. Run
vagrant ssh
- Navigate to the project within the vagrant machine.
cd /vagrant
- From this point you may now run either of the scripts mentioned above. (
record_twitch.sh
andsplit_files.sh
)
- Move Client ID, and OAuth Token into a configuration file.
- Optimize Vagrant deployment.
if you get an error that pervents you from accessing streams. Try this (it worked for me)...
- Step 1. (in terminal/cli) Type
livestreamer --twitch-oauth-authenticate
. - Step 2 copy the response url into Chrome will open and ask you to login to twitch. It will give you a "page does not exist" error. FeelsBadMan
- Step 3. Check the url. It has a section that says
access_token=xxxxxxxxxxxxxxxxxxxxxxxx
. Copy this string. - Step 4: use this as your oauthToken in record.py
The initial stream recording code came from Avernus on Pastebin http://pastebin.com/2w1wT18d
Script was made possible again by /u/TheOnlyLeo's & /u/DallasNChains' input.
S/O to JEGGOTT for the original pastebin at http://pastebin.com/BwzP6ayG.
This is free software, and is released under the terms of the GNU General Public License version 3. See: LICENSE