Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[
{
"stream": {
"mature": false,
"status": "Greg working on Electron-Vue boilerplate w/ Akira #programming #vuejs #electron",
"broadcaster_language": "en",
"display_name": "FreeCodeCamp",
"game": "Creative",
"language": "en",
"_id": 79776140,
"name": "freecodecamp",
"created_at": "2015-01-14T03:36:47Z",
"updated_at": "2016-09-17T05:00:52Z",
"delay": null,
"logo": "https://static-cdn.jtvnw.net/jtv_user_pictures/freecodecamp-profile_image-d9514f2df0962329-300x300.png",
"banner": null,
"video_banner": "https://static-cdn.jtvnw.net/jtv_user_pictures/freecodecamp-channel_offline_image-b8e133c78cd51cb0-1920x1080.png",
"background": null,
"profile_banner": "https://static-cdn.jtvnw.net/jtv_user_pictures/freecodecamp-profile_banner-6f5e3445ff474aec-480.png",
"profile_banner_background_color": null,
"partner": false,
"url": "https://www.twitch.tv/freecodecamp",
"views": 161989,
"followers": 10048,
"_links": {
"self": "https://api.twitch.tv/kraken/channels/freecodecamp",
"follows": "https://api.twitch.tv/kraken/channels/freecodecamp/follows",
"commercial": "https://api.twitch.tv/kraken/channels/freecodecamp/commercial",
"stream_key": "https://api.twitch.tv/kraken/channels/freecodecamp/stream_key",
"chat": "https://api.twitch.tv/kraken/chat/freecodecamp",
"subscriptions": "https://api.twitch.tv/kraken/channels/freecodecamp/subscriptions",
"editors": "https://api.twitch.tv/kraken/channels/freecodecamp/editors",
"teams": "https://api.twitch.tv/kraken/channels/freecodecamp/teams",
"videos": "https://api.twitch.tv/kraken/channels/freecodecamp/videos"
}
},
"_links": {
"self": "https://api.twitch.tv/kraken/streams/freecodecamp",
"channel": "https://api.twitch.tv/kraken/channels/freecodecamp"
}
},
{
"stream": null,
"display_name": "OgamingSC2",
"_links": {
"self": "https://api.twitch.tv/kraken/streams/ogamingsc2",
"channel": "https://api.twitch.tv/kraken/channels/ogamingsc2"
}
},
{
"stream": {
"mature": false,
"status": "RERUN: StarCraft 2 - Kane vs. HuK (ZvP) - WCS Season 3 Challenger AM - Match 4",
"broadcaster_language": "en",
"display_name": "ESL_SC2",
"game": "StarCraft II",
"language": "en",
"_id": 30220059,
"name": "esl_sc2",
"created_at": "2012-05-02T09:59:20Z",
"updated_at": "2016-09-17T06:02:57Z",
"delay": null,
"logo": "https://static-cdn.jtvnw.net/jtv_user_pictures/esl_sc2-profile_image-d6db9488cec97125-300x300.jpeg",
"banner": null,
"video_banner": "https://static-cdn.jtvnw.net/jtv_user_pictures/esl_sc2-channel_offline_image-5a8657f8393c9d85-1920x1080.jpeg",
"background": null,
"profile_banner": "https://static-cdn.jtvnw.net/jtv_user_pictures/esl_sc2-profile_banner-f8295b33d1846e75-480.jpeg",
"profile_banner_background_color": "#050506",
"partner": true,
"url": "https://www.twitch.tv/esl_sc2",
"views": 60843789,
"followers": 135275,
"_links": {
"self": "https://api.twitch.tv/kraken/channels/esl_sc2",
"follows": "https://api.twitch.tv/kraken/channels/esl_sc2/follows",
"commercial": "https://api.twitch.tv/kraken/channels/esl_sc2/commercial",
"stream_key": "https://api.twitch.tv/kraken/channels/esl_sc2/stream_key",
"chat": "https://api.twitch.tv/kraken/chat/esl_sc2",
"subscriptions": "https://api.twitch.tv/kraken/channels/esl_sc2/subscriptions",
"editors": "https://api.twitch.tv/kraken/channels/esl_sc2/editors",
"teams": "https://api.twitch.tv/kraken/channels/esl_sc2/teams",
"videos": "https://api.twitch.tv/kraken/channels/esl_sc2/videos"
}
},
"_links": {
"self": "https://api.twitch.tv/kraken/streams/esl_sc2",
"channel": "https://api.twitch.tv/kraken/channels/esl_sc2"
}
},
{
"stream": null,
"display_name": "noobs2ninjas",
"_links": {
"self": "https://api.twitch.tv/kraken/streams/esl_sc2",
"channel": "https://api.twitch.tv/kraken/channels/esl_sc2"
}
},
{
"error": "Not Found",
"status": 404,
"message": "Channel 'not-a-valid-account' does not exist"
}
]
@marko-hologram
Copy link

marko-hologram commented Mar 6, 2017

@carpben if I read your reply correctly, as far as I can see here you got enough options. Streams that have the "stream" property value of null are offline and streams that return a lot of data inside the "stream" property are online therefore giving you enough options to complete the task.

EDIT: My mistake, I looked at some wrong data. Yeah the original gist lacks offline channels, but offline channels have been added later so that the task could be completed.

@Ruchika30
Copy link

Ruchika30 commented Jun 21, 2017

how do i use this array. I am a beginner, Kindly help me . Thank you

@shyamvkansagra
Copy link

shyamvkansagra commented Aug 3, 2017

@Ruchika30...this data is the one which is supposed to come as a successful response of our request to twitch. So, instead of using "GET" method and fetching response, we can directly store this entire thing in a variable.
If you didn't get the above part, just skip to next line.
Like var someVar = ENTIRE_ARRAY_GIVEN_HERE. Then just use someVar[0]["XYZ"] like that to access the contents of this entire array thing. Here you will need 'logo','status' and 'display_name' parameters of a stream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment