Skip to content

Instantly share code, notes, and snippets.

@ryanfb
Created September 13, 2013 18:45
Show Gist options
  • Select an option

  • Save ryanfb/6554486 to your computer and use it in GitHub Desktop.

Select an option

Save ryanfb/6554486 to your computer and use it in GitHub Desktop.
Command line Flickr batch download script
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
ARGF.each_line do |line|
line.chomp!
save_file = line.split('/')[-2..-1].join('_') + '.jpg'
doc = Nokogiri::HTML(open(line + "/sizes/o/"))
doc.xpath('//div[@id="allsizes-photo"]/img/@src').each do |link|
puts "#{save_file}: #{line} => #{link}"
unless File.exist?(save_file)
`wget -O #{save_file} -c #{link}`
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment