I have this code so far:
$(document).ready(function() {
var channels = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp"];
var url = "https://wind-bow.glitch.me/twitch-api/users/freecodecamp?callback="
$.getJSON(url, function(data) {
console.log(data);
});
});
And that prints this to console:
{
display_name: "FreeCodeCamp",
_id: 79776140,
name: "freecodecamp",
type: "user",
bio: "We help you learn to code, then practice by building projects for nonprofits. Learn Full-stack JavaScript, build a portfolio, and get a coding job by joining our open source community at https://freecodecamp.com",
created_at: "2015-01-14T03:36:47Z",
updated_at: "2017-09-21T12:01:02Z",
logo: "https://static-cdn.jtvnw.net/jtv_user_pictures/freecodecamp-profile_image-d9514f2df0962329-300x300.png",
_links: {
self: "https://api.twitch.tv/kraken/users/freecodecamp"
}
}
Ok, from here I know that I need to access channel name, their channel link, and information about whether a channel is streaming or not.
I think it can be accessed like this:
var name = data.display_name;
var link = data.self;
Is that correct so far? I’m not sure what key to access for whether or not they are streaming though. Advice?