Hi,
I know many people have been requesting this or something similar. I’m also aware that Twitch doesn’t normally discuss potential features, so I guess this is just my two cents. Hopefull we’ll get this with v5 release in Feb.
My use case:
So my app keeps a historic record of total viewers and channels for a handful of games. It uses this data to identify trends using lots of fun maths.
The problem:
In order to get the viewers and channels for the games I want, I have to use the Get Top Games endpoint which understandably returns a max of 100 games at a time. Some of the games I track only have a few viewers and with Twitch averaging 1500-2000 live games, I find myself making 15-20 requests before I find all the games I’m tracking. I have to parse each response and end up completely discarding about 90% of them.
From a client side perspective this presents a number of problems.
- It adds complexity to your code
- It taxes your rate-limit for api calls
- It’s generally wasteful resource-wise
Possible Solution:
Make games requestable by ID using an endpoint such as this:
GET https://api.twitch.tv/kraken/games/id/{game_id}[,{game_id},{game_id},...]
Which would return something like this:
{
"game_id": {
"channels": 953,
"viewers": 171708,
"game": {
"_id": 32399,
"box": {
"large": "https://static-cdn.jtvnw.net/ttv-boxart/Counter-Strike:%20Global%20Offensive-272x380.jpg",
"medium": "https://static-cdn.jtvnw.net/ttv-boxart/Counter-Strike:%20Global%20Offensive-136x190.jpg",
"small": "https://static-cdn.jtvnw.net/ttv-boxart/Counter-Strike:%20Global%20Offensive-52x72.jpg",
"template": "https://static-cdn.jtvnw.net/ttv-boxart/Counter-Strike:%20Global%20Offensive-{width}x{height}.jpg"
},
"giantbomb_id": 36113,
"logo": {
"large": "https://static-cdn.jtvnw.net/ttv-logoart/Counter-Strike:%20Global%20Offensive-240x144.jpg",
"medium": "https://static-cdn.jtvnw.net/ttv-logoart/Counter-Strike:%20Global%20Offensive-120x72.jpg",
"small": "https://static-cdn.jtvnw.net/ttv-logoart/Counter-Strike:%20Global%20Offensive-60x36.jpg",
"template": "https://static-cdn.jtvnw.net/ttv-logoart/Counter-Strike:%20Global%20Offensive-{width}x{height}.jpg"
},
"name": "Counter-Strike: Global Offensive",
"popularity": 170487
}
}
}
Now I understand that Twitch uses GiantBomb info for some of its data (I assume that’s the “game”: {…} part) which is probably why this hasn’t already been implemented since this contains the id. I wouldn’t mind grabbing what I need from GiantBomb, however, I assume that the viewer and channel counts are on the Twitch side. So, if it would make this easier I would settle for just getting the viewer and channel counts.
{
"game_id": {
"channels": 953,
"viewers": 171708,
"name": "Counter-Strike: Global Offensive", // other people want this
"giantbomb_id": 36113, // maybe this would be useful too
}
}
Anyways, I know I’m not alone here. In my search for a better way I visited hundreds of threads discussing this. Hopefully this is something you guys can make happen for v5.
(Oh, if there actually is a better way to do this please let me know :))