Skip to content

ezhai/twitch-recorder

 
 

Repository files navigation

Stream Recorder for Twitch

A simple 24/7 script to record streams from Twitch.

This fork is based on the following projects.

Features

  • Record a live Twitch stream.
  • Automatically add metadata tags (i.e. stream title, broadcast date) to the recorded video file.
  • Adds chapters to the recorded video files based on game category.

Usage

python twitch-recorder.py -u <username>

Installation

Confirm that the executables are installed. If the your executable is named differently or is not on your PATH, either add it to the PATH or use the full path instead (e.g. C:\\bin\ffmpeg.exe).

python --version
streamlink --version
ffmpeg -version
ffprobe -version

You will also need to install the requests Python module.

python -m pip install -r requirements.txt

Tip: Use your operating system's package manager or a Python virtual environment to install Python modules.

Configuration

Copy config.py.template to config.py. Edit the configuration variables in config.py.

Twitch API Credentials (required)

Login to the Twitch Developer Console and register an application. After your application is created, you can retrieve the Client ID and Secret from the app page.

Twitch OAuth Token (optional)

By default, ad segments will be filtered out of the recorded video leaving a discontinuity in your video. Your Twitch OAuth Token can be used with Streamlink to avoid having these discontinuities by completely bypass ads if you are subscribed to the channel you are recording or have Twitch Turbo. Login to twitch.tv, open the browser console using F12 or Ctrl+Shift+I and paste the following command into the console. This is the token used by Twitch to authenticate your Twitch account, so be careful with it.

document.cookie.split("; ").find(item=>item.startsWith("auth-token="))?.split("=")[1]

Contribution

Have any issues or suggestions to improve the code? Feel free to open an issue or a pull request!

About

A tool to record live streams from twitch.tv.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages

  • Python 99.3%
  • Makefile 0.7%