Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Flickr library for Ruby

By Peter Cooper / July 3, 2006

Flickr.rb is an 'insanely easy' Ruby library to interface with the world's most popular photo-sharing service, Flickr.

Here's some example code:

require 'flickr'

# basics
flickr = Flickr.new                           # create a flickr client
flickr.login(email, password)                 # log in for actions that require it
flickr.users                                  # get all users currently online
flickr.photos                                 # get the 100 most recent public photos
flickr.tag('red')                             # search for photos tagged with 'red'
flickr.groups                                 # get all active public groups

# working with users
user = flickr.users('sco')                    # lookup a user by username
user = flickr.users('sco@scottraymond.net')   # or email
user.name                                     # get the user's real name
user.location                                 # and location
user.photos                                   # grab their collection of Photo objects...
user.tag('red')                               # search their photos for the tag 'red'
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

It gets way better than that though. If you're into photos or just cool APIs, check it out.

Comments

  1. Kevin Marsh says:

    Any idea why it's so slooooow? or have tips to speed it up?

    Searching for the latest 24 images for a tag takes about 5 minutes...

  2. TAD says:

    I was going to say the exact same thing Kevin! Actually, I've noticed that if you pull back images and don't request the information needed to point back to the Flickr page for the picture it works faster (though still pretty slow).

Other Posts to Enjoy

Twitter Mentions