Hi, we’re developing a streamer extension. We need to be able to evaluate streamer’s average viewer count to provide streamer with some insights.
The thing is - we see this is available in
- twitch channel analytics,
- 3rd party services - sullygnome, twitchtracker, etc
But we can’t find a way to get this via twitch API. Is it even possible? If not - how do these 3rd parties are able to provide these values?
The API doesn’t return the average
These sites will poll the API every minute/selected time scale and calculate their own average from that.
Hi, interesting… they poll every minute… but how can they do that on the whole streamer base.
Let’s say that off peak you have 15,000 streams simulaneously, that would give you 150 pages to paginate through, which with latency and processing maybe won’t work in 1min… and what search query would you use… top 500 games? ie 500 calls with some paginated, ie reaching quickly the 800/min limit… so imagine on peak time…
A bit confused about what strategy to have in order to get similar data as twitchtracker for example.
I don’t know their poll rate.
I only described a method on how it could be done. I’ve never tried to do it myself.
The rate limits are why many of these sites poll at 5, 10, or 15 minute intervals, and often only top streamers as Helix has dramatically reduced accuracy after the first few pages if you’re requesting all streams.
Also it’s worth noting that site like TwitchTracker are somewhat BS on certain metrics, like their subscriber counts for channels can be off by +/- 80% is the worst case I’ve seen from partners I work with so I can compare their actual numbers to what TwitchTracker shows.
It’s also possible for some of these sites to have a higher rate limit, as it used to be possible to request a rate limit increase if there was sufficient justification. This is now no longer possible though so any new apps must work within the current rate limits.
Thanks for the details. Let’s say I’d poll every 5 mins to stay within the limit, I still don’t get what kind of search query you would need to form to get all streams… my first idea was the top 500 games (there are not that many streams below that threshold) and you loop over the game id… or does anyone have a better suggestion?
Unless you frequently update your ‘top games’ list, that wont be of much use as what games are top fluctuate heavily, and some of the top streamers play games no one knows about which suddenly turns a game from 0 streams, to the most watch on Twitch.
If you want to get all streams? Short answer is, you can’t, at least not accurately enough for analytics.
What most stats sites do is simply poll through the Get Streams endpoint. You get 100 streams, use the pagination cursor to get the next 100, repeat. When you get to streams with <100 viewers, the results will become less accurate as a change of just a few viewers can move a stream back and forwards in page, leading to channels appearing on multiple pages, and potentially missing some other channels. This inaccuracy grows the further you page.
You could also supplement that list of streams with channels either manually added by you, or by users of your app, that way regardless of their position on the Get Streams list you could poll specifically for those channels.
yes indeed if I stop parsing when viewer_count is below 100 I get significantly less results and it is totally parseable in a few seconds, thanks for the tip
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.