Python 3.6+
Required packages: requests (http requests), pydantic (data validation), strictyaml (.yaml creation, validation), m3u8 (parsing HLS), iso8601 (parsing dates), mypy-extensions (extended type hints).
The script and lib are made for recording broadcasts and VODs from Twitch.tv.
Main purpose of default script is downloading live broadcast without
mute from currently recording VOD.
This allows you to create a good VOD storage with info from Twitch API.
The library doesn't use ffmpeg
or avconv
for downloading because
corresponding HLS-playlist are always finalized.
Library automatically detects when VOD is completed.
Default script (launcher.py
) actions:
- Checkup when the stream on channel goes
live
. - Wait until VOD corresponding to the stream appears in Twitch API.
(by difference between stream's
started_at
and VOD'screated_at
) - Download VOD while its duration is increasing.
- Move file to storage.
- Go to 1.
Library use latest Twitch API Helix (docs).
All broadcasts will be saved *.ts
as it presented on twitch.tv.
Use ffmpeg
after if you want to convert files to another format.
You can enable telegram notifications about start/stop downloading and fatal errors if you want.
Install pipenv if it doen't installed yet.
git clone https://github.com/tausackhn/twlived.git
cd twlived && pipenv --python 3.6 && pipenv install && pipenv shell
Run launcher.py
to generate configuration file template config.yaml
.
pipenv run launcher.py
Open config.yml
and edit it.
Necessary positions are marked with <>
.
To get client-id
you should go https://dev.twitch.tv/dashboard/apps and Register your application
.
After all run again to start proccess
pipenv run launcher.py
- Add authorization flow for private VODs.
- Add support for live broadcasts. (Streamer could turn off recording VODs.)
- Add support for all type of video.