Skip to content

Instantly share code, notes, and snippets.

@slaingod
Created May 23, 2016 00:39
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 slaingod/0c725801ee2b7a9a4f5e73db8ac0f9f7 to your computer and use it in GitHub Desktop.
Save slaingod/0c725801ee2b7a9a4f5e73db8ac0f9f7 to your computer and use it in GitHub Desktop.
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