Code Monkey home page Code Monkey logo

twlived's Introduction

twLiveD

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:

  1. Checkup when the stream on channel goes live.
  2. Wait until VOD corresponding to the stream appears in Twitch API. (by difference between stream's started_at and VOD's created_at)
  3. Download VOD while its duration is increasing.
  4. Move file to storage.
  5. 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

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

Usage

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

TODOs

  • Add authorization flow for private VODs.
  • Add support for live broadcasts. (Streamer could turn off recording VODs.)
  • Add support for all type of video.

twlived's People

Contributors

tausackhn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

oxosec

twlived's Issues

Twitch live hls recording

I'm not sure if you've tried it and ran into the same problem as ffmpeg but streamlink (a fork of the now dead livestreamer) is a good tool that hasn't failed on me for downloading twitch streams live. It's usually for just watching streams live but you can have it write to a file with a python script to automatically watch the channel in intervals to see when it goes live and then start saving the stream to a file until the end.

I did it for the Mr Rogers one and it seemed to get it all without any errors, that I know of.

Also, with twitch vods, for say a stream that goes on for 12 hours or more, I think I've seen VODs muted while the streamer is still on if I'm not mistaken, so downloading the vod could be an issue in case twitch mutes it before you are able to get the file. Also with a long stream, downloading the file could take a while and maybe during that time, twitch mutes the vod and the file you download changes with the muted track added in.

also, do you have plans to add chat support to it? Say maybe syncing the stream vod to a chat log with scrubbing support?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.