I know we have possibility to multiple stream names in api.twitch.tv/streams?channel=a,b,c,d.
But the problem is when I want to get info also about streamers offline, getting 40-50 iterations of $.ajax calls take a lot of time for me.
Anyone can help me?
Sounds like you should be collecting and caching channel objects for 24 hours, just poke /streams/ to check for online status, using the cached channel object as a base for a offline stream (updating your cached from the online packet).
So there is no way to get one API request like api.twitch.tv/kraken/channels?name=a,b,c,d…
- The other idea is to get ~50 json request:
save it to one .json file on server and read from that json. but is hard to realize that thing.
- what do you mean by caching channel objects? some example?
I’ve been wondering the same thing. At the moment I’m just looping over an array of the channels I want to retrieve information about, with an individual http: request for each one.
As you mentioned above, you can get information about multiple streams in one request. https://github.com/justintv/Twitch-API/blob/master/v3_resources/streams.md#get-streamschannel
Unfortunately, if the channel isn’t streaming at the time of the request, the response doesn’t provide the information I need about the channels. So I’m stuck with doing 25+ separate channel http requests (and requesting the streaming information separately).
What I do is do the /stream check and store the channel object from that.
Generally, unless you are directly using the title/game keys from the channel object, there is no need to update the channel object.
So the channel object inside the stream object should suffice
I cant get it. How do you want to get followers number from /stream API?
If the stream is live
okey its i know, but i want to get FOLLOWERS from OFFLINE stream with one request like “api.twitch.tv/kraken/channels?name=a,b,c,d…”.
You’d have to do independant requests for each channel
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.