Comment by paraxisi
6 years ago
Quite a nice idea, well done! Very minimalist and clean as well. Few pieces of feedback after playing with it for a few minutes-
Not sure if I'm getting unlucky or the results are cached but quite a few of the streamers who popped up were offline. Using the twitch api under the hood I assume?
Ya due to the way getting acess to this works, theres a 10 minute cache of active streams that get expired in redis and a cron job pulls in a fresh list
If you are not already, you could use the GraphQL API that the web app uses, which provides sorting by viewers ASC. That would allow for much more up to date results than iterating the full list with the official API.
Not sure how happy Twitch is about external users, but it can be accessed quite easily with some tinkering.
This is exactly what its doing, albeit caching results, somce im trying to be nice. Official api sadly does not allow sorting by asc.
Hopefully they're cool about it. Typically companies like this frown upon ersatz API usage and cache/rehosting of their data.
Is there a reason for a 10 minute cache duration? Even 1 minute would be fine from a performance point of view
So I'm not hitting the api too much, this is going through a roundabout way to get this data