Giter VIP home page Giter VIP logo

stream-archive's Introduction

Stream Archive

What is it?

A simple command line tool to record/archive livestreams as they are happening. It is meant to continuously run in the background, probably on a server, a Raspberry Pi or something of the sort. It will simply record all provided Twitch channels that are streaming while the program is running.

How does it work?

Every 30 seconds it requests which of the provided channels are live (using the Twitch Helix API) and for those that are, it'll start a recording (using streamlink) in a new Thread. It also keeps track of which channels it is currently recording to not start redundant recordings every 30 seconds. The recordings are put into directories for its respective channels under a given directory or the run directory of the program.

Requirements

  1. A Twitch client-id and secret for authentication against Twitch Helix API.
  2. Streamlink installed and in your PATH

How to use

  1. Copy config-example.json into config.json and fill in your client-id and secret.
  2. List the channels you want to record in channels.txt (chess & chess24 are just examples and can of course be removed) one line per channel
  3. Preferably use screen or something similar so you can exit the terminal without stopping the application
  4. Start the application with ./stream-archive "/where/ever/you/want/your/recordings", if no directory is provided it will use the current directory.

Couldn't this be done simpler and/or without the need for a client-id?

Yes! To both! One could do a simpler version of this, completely skip the Twitch api and just spam streamlink calls for every channel every 30 seconds. Streamlink even has an integrated command line argument to retry streams, but that will stop after it recorded successfully for the first time iirc. One could also replace the request to Helix with a simple GET Request to every single channel, but I am not a fan of spamming dozens of requests if I can use a single one.

I am aware that the need for a client-id will probably dissuade about 99% of potential users; maybe I will provide a version without a client-id in the future. But I also assume that tools for this use case already exist (probably even better ones!), I did this mostly for fun, not because I couldn't find an alternative.

Possible Improvements in the future, unordered

  • Configurable naming scheme for files
  • Maybe a little configuration TUI
  • Option to rotate files, Stream recordings add up quick. Maybe some functionality to delete after x days or x TB filled
  • Skipping reruns: As soon as I figure out how, the helix api provides a "type" value, but infuriatingly it only distinguishes between 'live' and 'error' (doesn't exist for not being live)

Why is there no Windows version?

Honestly? Because the cross compilation failed and I didn't take the time to debug it. I think it should work on Windows, given streamlink is provided. I will probably try it at some point and provide a Windows release. But I assume most people will run this on some sort of Linux server anyway.

stream-archive's People

Contributors

legendarymarvin avatar

Watchers

 avatar

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.