Posted By

szsk on 06/04/08


Tagged

rss feed ruby comment delicious


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

zegenvs
webstic


get del.icio.us bookmark's descriptions


 / Published in: Ruby
 

code based on http://diaspar.jp/node/145

  1. require 'net/http'
  2. require 'open-uri'
  3. require 'rubygems'
  4. require 'digest/md5'
  5. require 'rexml/document'
  6.  
  7. def get_delicious_comments( url )
  8. posts = []
  9. host = 'feeds.delicious.com'
  10. path = '/rss/url/' + Digest::MD5.hexdigest( url )
  11. body = Net::HTTP.start( host, 80 ).get( path ).body
  12. xml = REXML::Document.new( body )
  13.  
  14. xml.elements.each('rdf:RDF/item') do |item|
  15. if item.elements['description'].text
  16. post = {
  17. :date => item.elements['dc:date'].text[0..9],
  18. :user => item.elements['dc:creator'].text,
  19. :cmnt => item.elements['description'].text,
  20. :site => "del.icio.us"
  21. }
  22.  
  23. posts.push( post )
  24. end
  25. end
  26.  
  27. return posts
  28. end

Report this snippet  

You need to login to post a comment.