Skip to content

Instantly share code, notes, and snippets.

@taylor01
Created August 7, 2016 19:16
Show Gist options
  • Save taylor01/b92749b679e9b4b483399033f15f8328 to your computer and use it in GitHub Desktop.
Save taylor01/b92749b679e9b4b483399033f15f8328 to your computer and use it in GitHub Desktop.
require 'open-uri'
require 'net/http'
(1..1000).each do |n|
uri = URI("http://static.musictoday.com/store/bands/6/product_large/DMAP#{n}.JPG")
request = Net::HTTP.new uri.host
response = request.request_head uri.path
if response.code.to_i == 200
open("images/DMAP#{n}.JPG", 'wb') do |file|
file << open("http://static.musictoday.com/store/bands/6/product_large/DMAP#{n}.JPG").read
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment