Skip to content

Instantly share code, notes, and snippets.

@ashlynnpai
Created September 18, 2017 16:16
Show Gist options
  • Save ashlynnpai/4437db06a7a3ae0b3e471daec9517d76 to your computer and use it in GitHub Desktop.
Save ashlynnpai/4437db06a7a3ae0b3e471daec9517d76 to your computer and use it in GitHub Desktop.
call to Twitch API
function getFeed() {
$.getJSON('https://wind-bow.glitch.me/twitch-api/streams/freecodecamp?callback=?', function(data) {
var isStreaming = document.getElementById("report");
if (data.stream == null) {
isStreaming.innerHTML = "Down"
}
else {
var a = document.createElement("a");
var streamStatus = document.createTextNode("Up");
a.appendChild(streamStatus);
a.title = "Up";
a.href = data._links.channel;
isStreaming.append(a);
var getDetails = document.getElementById("details");
getDetails.innerHTML = data.stream.channel.status;
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment