Instinctlol / automatic-twitch-recorder

Checks if a user on twitch is currently streaming and then records the stream via streamlink
187 stars 40 forks source link

Easier Webhook setup. #25

Closed TheDevFreak closed 4 years ago

TheDevFreak commented 4 years ago

While looking through the codebase the method used for webhooks looks a little complicated. Why not just use this library and the ngrok library? https://github.com/Teekeks/pyTwitchAPI

Instinctlol commented 4 years ago

There's no webhook support atm, because there's no need for it. I decided to take it out. I migrated to the new Twitch API and now one can make 800 API Calls per minute per user. So with an interval of 1 seconds, theoretically, checking if a streamer or if multiple streamers is / are online every second makes 60 API calls per minute, which is far from the allowed 800. So right now, there's no need for webhooks for this project.

Also if one were to implement webhooks, one would need to handle this quirky delay. Example scenario: twitch stream goes offline -> streamlink stops recording as a result of that. But the application would still expect the stream to be online, because the offline notification will be received in 6 mins after the fact. So to resolve this issue, one would need to make use of the usual API to check whether the stream is offline or not. Then, because you need to use the normal API anyway, one could just disregard webhooks altogether and that's what I did.