-
-
Save anonymous/e378c3c950d4fdf3a8e456200044e81f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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