Skip to content

Instantly share code, notes, and snippets.

@toolmantim
Created December 19, 2008 01:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toolmantim/37748 to your computer and use it in GitHub Desktop.
Save toolmantim/37748 to your computer and use it in GitHub Desktop.
# Downloads all the photos from a flickr set
require 'open-uri'
require 'rubygems'
require 'flickr-rest' # benschwarz-flickr-rest
Flickr::Query::API_KEY = 'your key, yo.'
Flickr::Query.new('57794886@N00').
execute('flickr.photosets.getPhotos', :photoset_id => '72157609406563810').search('photo').each do |photo|
unless File.exist?(filename = "/tmp/#{photo['id']}.jpg")
open(filename, "w+") do |f|
f.write open("http://farm#{photo['farm']}.static.flickr.com/#{photo['server']}/#{photo['id']}_#{photo['secret']}_o.jpg").read
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment