Cheking stream online or offline

Hello,

i had a site which user can share the streaming link from twitch, and i want the API give me the status of that link “online” or “offline”. Our website will turn-on or turn-off that link automaticlly .

Sorry, my english is not good, hope u understand.

Could you please give us the solution?

This can be accomplished using a simple jquery ajax GET request to: https://api.twitch.tv/kraken/streams/CHANNEL_NAME.

It will return a stream object if the channel is live.

API Link: https://github.com/justintv/Twitch-API/blob/master/v3_resources/streams.md

2 Likes

Hi Teak,

by doing a single request against the following url I can get a lot of data of all the channels that I am following:

https://api.twitch.tv/kraken/users/fuecisla1/follows/channels?limit=100&client_id=’ + clientId;

However the API does not return in the json if the channel is broadcasting live or not. Is there any way to request that data. I would really like to avoid making as many http requests as channels I follow.

Any ideas? I only seem to find ways to ask channel by channel…:frowning:

Cheers,

You can only do it channel by channel.

The streams end point can only return one channels information.

As a work around, you can follow all the channels you want info on and then call follows API ( https://dev.twitch.tv/docs/api/v3/users#get-streamsfollowed ) with the stream_type=live flag instead.