Published in: Ruby
code based on http://diaspar.jp/node/145
require 'net/http' require 'open-uri' require 'rubygems' require 'digest/md5' require 'rexml/document' def get_delicious_comments( url ) posts = [] host = 'feeds.delicious.com' path = '/rss/url/' + Digest::MD5.hexdigest( url ) body = Net::HTTP.start( host, 80 ).get( path ).body xml = REXML::Document.new( body ) xml.elements.each('rdf:RDF/item') do |item| if item.elements['description'].text post = { :date => item.elements['dc:date'].text[0..9], :user => item.elements['dc:creator'].text, :cmnt => item.elements['description'].text, :site => "del.icio.us" } posts.push( post ) end end return posts end
You need to login to post a comment.
