Question on How to lookup what game a streaming is playing in the new API


#1

Question I have started looking at switching from the old API to the New API. I was wondering how do I find what StreamerX is currently Streaming? I mean you can what their current Stream Title is but what about the Game they are currently Streaming?


#2

You can use the Get Streams endpoint which will return their stream, this will include a game_id. You can then use that game_id as the id querystring param for the Get Games endpoint which will return the game name and boxart for that id.

Depending on your use case, it may be beneficial to cache results from the Get Games request so that you don’t have to make as many repeated lookups.


#3

I have a related question for the new API. One issue with the GetStreams endpoint is that it only returns the game for a channel in the new API only if the stream is currently live. In v5, we can lookup what game/category the streamer was in even after they had finished streams and therefore create things like a shoutout chatbot command that retrieves the game they were playing, but there doesn’t seem to be a way to do this using Helix endpoints. Is this a use-case that will be supported in the new API?


#4

I don’t believe there are any plans to show historical stream information through the new API. While there may be valid use cases for this data they can easily be accomplished by just caching the last stream state on your end.


#5

I’m not sure that’s so easy. To shoutout a streamer along with the game they were playing, especially if they are newcomers, would mean the bot would have to cache the last stream state of every stream on Twitch.


#6

I’m still not quite sure why you’d want to shoutout with out of date information that may no longer be of any relevance (the last stream could potentially be a long time ago, or of a game they no longer play), but if that’s what you want to do and want to have that old information for every single streamer on Twitch then yes you’ll have to cache every single streamer on Twitch (and be careful of potential developer agreement issues you may run in to if you want to store this sort of data)

Perhaps you may want to use this as an opportunity to rethink your shoutout system as in most cases these sort of things can benefit from being short and to the point, rather than bloated with information users don’t really need if all they want to do is be able to follow a link to their channel.