Lucky for us, instead of forcing us to use OAuth or API keys or sacrificing chickens, twitch makes it really easy to see what's going on with any stream. Yay!

All you have to do is go to https://api.twitch.tv/kraken/streams/adafruit and you'll be able to see the current status of the adafruit stream. Just change the last part of the url to see another stream

The data will be a json package, in ascii text. For example, if the stream is active:

{"stream":{"_id":20082214992,"game":null,"viewers":0,"created_at":"2016-03-09T02:51:06Z","video_height":540,"average_fps":30,"delay":0,"is_playlist":false,"_links":{"self":"https://api.twitch.tv/kraken/streams/ladyada1337"},"preview":{"small":"http://static-cdn.jtvnw.net/previews-ttv/live_user_ladyada1337-80x45.jpg","medium":"http://static-cdn.jtvnw.net/previews-ttv/live_user_ladyada1337-320x180.jpg","large":"http://static-cdn.jtvnw.net/previews-ttv/live_user_ladyada1337-640x360.jpg","template":"http://static-cdn.jtvnw.net/previews-ttv/live_user_ladyada1337-{width}x{height}.jpg"},"channel":{"mature":null,"status":null,"broadcaster_language":null,"display_name":"ladyada1337","game":null,"language":"en","_id":113575809,"name":"ladyada1337","created_at":"2016-01-23T00:38:01Z","updated_at":"2016-03-09T02:15:32Z","delay":null,"logo":null,"banner":null,"video_banner":null,"background":null,"profile_banner":null,"profile_banner_background_color":null,"partner":false,"url":"http://www.twitch.tv/ladyada1337","views":11,"followers":0,"_links":{"self":"http://api.twitch.tv/kraken/channels/ladyada1337","follows":"http://api.twitch.tv/kraken/channels/ladyada1337/follows","commercial":"http://api.twitch.tv/kraken/channels/ladyada1337/commercial","stream_key":"http://api.twitch.tv/kraken/channels/ladyada1337/stream_key","chat":"http://api.twitch.tv/kraken/chat/ladyada1337","features":"http://api.twitch.tv/kraken/channels/ladyada1337/features","subscriptions":"http://api.twitch.tv/kraken/channels/ladyada1337/subscriptions","editors":"http://api.twitch.tv/kraken/channels/ladyada1337/editors","teams":"http://api.twitch.tv/kraken/channels/ladyada1337/teams","videos":"http://api.twitch.tv/kraken/channels/ladyada1337/videos"}}},"_links":{"self":"https://api.twitch.tv/kraken/streams/ladyada1337","channel":"https://api.twitch.tv/kraken/channels/ladyada1337"}}

And if not active...

{"stream":null,"_links":{"self":"https://api.twitch.tv/kraken/streams/adafruit","channel":"https://api.twitch.tv/kraken/channels/adafruit"}}

There is a ton of details over at https://github.com/justintv/Twitch-API but we're going to be lazy and just parse the data manually.

If we see the string {"stream":{"_id" then we know the stream is active. If we see the string {"stream":null then we know it is not.

One thing to note is you must use SSL to connect, if you try to connect without, you'll get

{"error":"Bad Request","message":"Requests must be made over SSL","status":400}

This guide was first published on Mar 10, 2016. It was last updated on Mar 10, 2016.

This page (Twitch API) was last updated on Mar 08, 2016.

Text editor powered by tinymce.