Skip to content

Instantly share code, notes, and snippets.

/twitch.js Secret

Created August 12, 2017 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/e378c3c950d4fdf3a8e456200044e81f to your computer and use it in GitHub Desktop.
Save anonymous/e378c3c950d4fdf3a8e456200044e81f to your computer and use it in GitHub Desktop.
function getUser(name){
var output = new Object();
$.ajax({
type: "GET",
url: "https://wind-bow.gomix.me/twitch-api/users/" + name,
dataType: "jsonp",
success: function(data){
output.name = data.display_name;
output.logo = data.logo;
output.link = "https://www.twitch.tv/"+output.name;
console.log(output);
return output;
}
});
}
function getStream(output){
$.ajax({
type: "GET",
url: "https://wind-bow.gomix.me/twitch-api/streams/" + output.name,
dataType: "jsonp",
success: function(data){
if(data.stream){
output.status = "green";
output.info = data.stream.channel.status;
}else{
output.status = "red";
output.info = "Offline";
}
console.log(output);
return output;
}
});
}
console.log(getStream(getUser("esl_sc2")));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment