Created
August 7, 2016 19:16
-
-
Save taylor01/b92749b679e9b4b483399033f15f8328 to your computer and use it in GitHub Desktop.
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 '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