Created
December 1, 2008 00:21
-
-
Save trevorturk/30559 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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