Skip to content

Instantly share code, notes, and snippets.

@vadviktor
Created August 30, 2012 14:22
Show Gist options
  • Save vadviktor/3529501 to your computer and use it in GitHub Desktop.
Save vadviktor/3529501 to your computer and use it in GitHub Desktop.
Download files with Ruby
require 'net/http'
require 'uri'
url = URI.parse( "http://mi9.com" )
Net::HTTP.start( url.host, url.port ) do |http|
(83514..83593).to_a.each do |img|
img_1280 = http.get "/uploads/abstract/4661/vector-room_1280x1024_#{img}.jpg"
filename = "vr_1280x1024_#{img}.jpg"
open( filename, "wb" ) do |file|
puts "downloading #{filename}"
file.write img_1280.body
end
end
end
puts "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment