Viewcount for Games/Categories

Regarding https://dev.twitch.tv/docs/api/reference#get-top-games AND https://dev.twitch.tv/docs/v5/reference/games#get-top-games

Is there ANY way to get a viewcount for a category in the current api?
I know you can just use the Legacy Twitch API v5, but I want to be future proof.

You would need to use the Get Streams endpoint https://dev.twitch.tv/docs/api/reference#get-streams with the game_id param for the game you wish to know the viewer count of, and page through the streams and sum the results yourself.

Game developers can access the Get Game Analytics endpoint https://dev.twitch.tv/docs/api/reference/#get-game-analytics which will give accurate data, but for 3rd party developers the only option is to page through the Get Streams endpoint which is inherently inaccurate so you will always have some degree of error.

Here is an example to demonstrate the logic

https://barrycarlyon.github.io/twitch_misc/examples/browse_categories/

Uses implict auth for demo purposes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.