Created
August 12, 2011 04:48
-
-
Save bugcloud/1141479 to your computer and use it in GitHub Desktop.
make you hot
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 'net/http' | |
require 'uri' | |
BIJIN = "www.bijint.com" | |
now = Time.now | |
#puts "choose your favorite prefecture, jp/gal/hokkaido/sendai/kobe/kyoto/fukuoka/nagoya" | |
#pref = gets.chomp! | |
pref = "jp" | |
dir = "#{ENV['HOME']}/Desktop" | |
begin | |
Net::HTTP.start(BIJIN, 80){|http| | |
res = http.get("/#{pref}/tokei_images/#{(now.hour/10 < 1)? "0" : ""}#{now.hour}#{(now.min/10 < 1)? "0" : ""}#{now.min}.jpg", {"Referer" => "http://www.bijint.com/#{pref}/"}) | |
open("#{dir}/#{now.to_s}.jpg", "wb"){|file| | |
file.puts res.body | |
} | |
} | |
rescue | |
p "failed to get image." | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment