Created
May 23, 2016 00:39
-
-
Save slaingod/0c725801ee2b7a9a4f5e73db8ac0f9f7 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
require 'open-uri' | |
$url = "http://prod.honorbound.api.juicebox-games.com/heroes" | |
begin | |
while true | |
next_at = Time.now | |
next_at = (next_at - next_at.sec + 60) | |
sleep_for = next_at.to_i - Time.now.to_i | |
sleep sleep_for if sleep_for > 0 | |
timestamp = Time.now.strftime('%Y%m%d_%H%M%S') | |
begin | |
open($url) do |f| | |
File.open("leaderboards\\leaderboard_#{timestamp}.html", 'w') { |file| file.write(f.read) } | |
end | |
rescue Exception => e | |
sleep 5 | |
retry | |
end | |
puts timestamp | |
end | |
rescue Exception => e | |
sleep 60 | |
retry | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment