Skip to content

Instantly share code, notes, and snippets.

@trevorturk
Created December 1, 2008 00:21
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 trevorturk/30559 to your computer and use it in GitHub Desktop.
Save trevorturk/30559 to your computer and use it in GitHub Desktop.
# http://github.com/jnunemaker/httparty/
require 'rubygems'
require 'httparty'
class Delicious
include HTTParty
base_uri 'https://api.del.icio.us/v1'
def initialize(u, p)
@auth = {:username => u, :password => p}
end
def recent(options={})
options.merge!({:basic_auth => @auth})
self.class.get('/posts/recent', options)
end
end
USERS = ['trevorturk', 'timothyoconnell']
puts "Getting delicious links for: #{USERS.join(' & ')}"
print 'Password: '
password = gets.chomp
USERS.each do |u|
puts "START #{u}..."
delicious = Delicious.new(u, password)
links = delicious.recent(:query => {:count => '50'})['posts']['post']
links.each do |l|
puts "<p><a href=\"#{l['href']}\">#{l['description']}</a>"
puts "<blockquote>#{l['extended']}</blockquote></p>"
puts
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment