API - See ALL live streams instead of specific channels


I am currently developing a site where users can visit to see if a streamer is live, their viewer count, etc. After they enter a twitch channel name, I’m using a loop that requests the Twitch API data for their input (example: https://api.twitch.tv/kraken/streams/myrtlizer) every 5 seconds (or an interval of their choice) to show and new updates.

Since I am requesting this data frequently (potentially with multiple sessions requesting unique channel data), is there any way for me to obtain the data for ALL live streams (example: https://api.twitch.tv/kraken/streams/)?

I will then store this data myself, and parse through it every so often rather than requesting the API data every 5 seconds.

Thanks in advance!

Instead of requesting all channels, why not batch the channels your users are requesting data about and run a single request (or multiple if its over 100 channels) every 5 seconds and then send that data out to your users.

To answer your question though you have to iterate over /streams in batches of 100 to get all streams. It cannot be done with a single request.

1 Like

Thank you very much for the reply. I will definitely look into batching as another option.

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