Skip to content

Instantly share code, notes, and snippets.

@sashadev-sky
Forked from robertjwhitney/download.rb
Created June 3, 2020 17:15
Show Gist options
  • Save sashadev-sky/ba6b504b2627c51ef3364f83edb73c58 to your computer and use it in GitHub Desktop.
Save sashadev-sky/ba6b504b2627c51ef3364f83edb73c58 to your computer and use it in GitHub Desktop.
simple script to download an array of images over http
require 'net/http'
require 'yaml'
files = YAML.load_file("image_list.yml")
i = 1
files.each do |file|
# use root url without protocol
response = Net::HTTP.start("farm5.static.flickr.com") do |http|
http.get("#{file}")
end
puts "#{response}"
File.open("#{i}.jpg", "w").write(response.body)
i += 1
end
---
- /4130/5020404434_1522d34a0b.jpg
- /4087/5395859868_953025d4ee_m.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment