Skip to content

Instantly share code, notes, and snippets.

@leovarmak
Created April 28, 2017 05:40
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 leovarmak/c4807e976c7456f303a844c57fca7f24 to your computer and use it in GitHub Desktop.
Save leovarmak/c4807e976c7456f303a844c57fca7f24 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
getStats(); //Executes the function to get stats from the steam gauge API
setInterval(function(){ // This functions automatically
getStats(); // sends a G request every 60 seconds
}, 60000);
function getStats() {
$.getJSON( "https://steamgaug.es/api/v2", function( data ){
console.log(data.ISteamGameCoordinator[570].online)
console.log(data.ISteamGameCoordinator[570].stats.players_searching);
if (data.ISteamGameCoordinator[570].online == 1) {
alert("Dota 2 is Online \nPlayers searching right now: " +data.ISteamGameCoordinator[570].stats.players_searching);
}
});
}
});
</script>
</head>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment