Skip to content

Instantly share code, notes, and snippets.

@yuzu441
Last active August 29, 2015 14:02
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 yuzu441/ef1ee653cd50e80b96c5 to your computer and use it in GitHub Desktop.
Save yuzu441/ef1ee653cd50e80b96c5 to your computer and use it in GitHub Desktop.
余りにも授業が暇だったので美人さん見て暇潰そうとしたら、プログラム書くのに時間かかって授業が終わった
require 'open-uri'
require 'fileutils'
#保存する地域設定
#地域のディレクトリ名を調べて追加してください
#取得したくない地域の先頭に#を付けるとその地域を取得しない
#例(kobeを取得しない) #"kobe", という感じ
areaArr = [
"kobe",
"kyoto",
"osaka",
"akita",
"saitama",
]
areaArr.each do |a|
dir = "./bijint/" + Time.now.strftime("%Y-%m-%d") + "/" + a + "/"
url = "http://www.bijint.com/" + a + "/tokei_images/"
t = Time.local(2014,1,1,0,0)
FileUtils.mkdir_p(dir)
1440.times do
file_name = t.strftime("%H%M") + '.jpg'
open(dir + file_name, 'wb') do |f|
open(url + file_name) do |d|
f.write(d.read)
end
end
puts a + "/" + file_name
t += 60
end
end
puts '取得が完了しました'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment