Twitch Multi-Calling Broken (new API call?) and Online/Offline check

I run a multi-game community and a few months ago I created a Javascript widget which makes a call to the Kraken API with a bunch of usernames put into a URL from an array. It then displays whether their stream is online or offline in alphabetical order.

You can see the live version of it on the right on the home page:

The call looked like this:
https: api.twitch.tv/kraken/streams?channel=agamemnus,chiddiru,eldranis,jeheil,jetleet,kaizmo,l0n3y,maraurder,nakid_ua,netherdawn,tanlash,unrealaussies&callback=?

A week or 2 ago the Twitch monitor stopped working and only displayed offline for everyone (due to the call not working anymore).

I’ve had a play around with the API and this call tends to work well, although only for a single user
https: api.twitch.tv/kraken/channels/nakid_ua

Is there a way to call multiple channels still? If not, is there still a limiter on the amount of calls made from an IP per hour? This is obviously mitigated in my case since it uses Javascript and calls itself on the client-side, although when I was initially developing this (with individual calls) it would only make 2 calls before the script stopped functioning.

I also noticed that with this new call, there is no way of knowing if the stream is live or not. The old way changed the “name” property to “live_user_nakid_ua”, although now it just says “nakid_ua” regardless. Is there a new way of detecting this?

Any help would be much appreciated. Thank you.

The “channel” parameter still works like it always has, but remember that the /streams resource only returns live streams, not offline ones.
So you’d still want to use the call just like you describe, and treat any stream that is not returned as being offline.

There is still rate limiting, and you should always include your client id (See https://github.com/justintv/Twitch-API#rate-limits)

Also remember to include the “api_version” parameter for the resource, as it may save you some trouble in the future (the latest is version 3, which it defaults to if you leave it out)

2 Likes

Ok thanks a lot, recoded it to account for that and added the api version so hopefully it won’t break again :slight_smile: