An insanely easy interface to the Flickr photo-sharing service. By Scott Raymond.
USAGE:
require 'flickr'
flickr = Flickr.new # create a flickr client
user = flickr.users('sco@scottraymond.net') # lookup a user
user.getInfo.name # get the user's name
user.location # and location
user.photos # grab their collection of Photo objects...
user.groups # ...the groups they're in...
user.contacts # ...their contacts...
user.favorites # ...favorite photos...
user.photosets # ...their photo sets...
user.tags # ...and their tags
recentphotos = flickr.photos # get the 100 most recent public photos
photo = recent.first # or very most recent one
photo.getInfo.url # see its URL,
photo.title # title,
photo.description # and description,
photo.owner # and its owner.
File.open(photo.filename, 'w') do |file|
file.puts p.file # save the photo to a local file
end
flickr.photos.each do |p| # get the last 100 public photos...
File.open(p.filename, 'w') do |f|
f.puts p.file('Square') # ...and save a local copy of their square thumbnail
end
end
Required files
cgi
net/http
xmlsimple