Create a gist now

Instantly share code, notes, and snippets.

Opens a random flickr photo, based on a supplied search tag term.
#!/usr/bin/env ruby
require 'flickraw'
require 'launchy'
FlickRaw.api_key = 'YOUR_API_KEY_HERE'
FlickRaw.shared_secret = 'YOUR_SHARED_SECRET_HERE'
results = flickr.photos.search(:tags => ARGV[0])
rand = Random.new.rand(results.length)
info = flickr.photos.getInfo(:photo_id => results[rand].id)
url = FlickRaw.url_b(info)
Launchy.open(url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment