Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
require 'mechanize'
require 'zip/zip'
agent = Mechanize.new
page = agent.get('http://mh.websimu.mydns.jp/4g_csv/')
filename = page.links[0].uri.to_s
puts "saved #{filename}"
File.write(filename, page.links[0].click.body)
Zip::ZipFile.open(filename) do |zip|
zip.each do |entry|
puts "extract #{entry.to_s}"
zip.extract(entry, entry.to_s) { true }
end
end
File.delete(filename)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment