Get Random Game Stream List from API


I run Ludum Dare. We’re an online game development jam event that sees a few hundred user streams for our ‘game’ (“Ludum Dare”) pop up during our events. We have a custom widget on our website that shows the top 4+ streams at once (soon to be more), but we have some popular streamers that participate in our event (Notch, Quill18), and it frustrates our users that all the top spots go to them. I’d like to provide a way to view random streams in our widget, but currently there’s no way to make such a request to the API. I’m only able to request the top results.

Any help would be appreciated.

Mike Kasprzak

If I understand you correctly, what I would do is simply get a list of streams pulled and select a few random ones. Just make a request to[list of games you want to retrieve separated by comma]

parse the results and tell php to randomly select a few random entries!

Yes, that would effectively give us what looks like random streams, but it would mean our users would be hitting the Twitch API servers with hundreds of requests for ~100 streams per second (JavaScript API), and that’s not very neighbourly. :wink:

I am facing the same issue with a different request that I am making. The way I solve it is through a cronjob script. Every 5-10 mins I check which streams are online and write that into a db. Later on I do the selection thingy. Other than that, I don’t think that there is currently a way to do what you want. I could be wrong though!

Right, there’s not currently a way, but the Channels page has (recently?) introduced a random option.

I’m requesting that same sort of option on the API side for Streams. Currently it’s only the Channels page with this option. Game pages do not have it.

Hi PoV! We actually do have a random streams API call which is currently in beta (so there’s no guarantee it will be supported indefinitely). It’s at Feel free to use it, and let me know if you encounter any problems!

1 Like

Great! I will check it out. Thanks!

Hi, It’s possible to sort by language with “/?language=fr” ?