How to Retrieve Delicious Tags and Number of Bookmarks for a Given Url

In case that’s of any use to you, here’s how you can query Delicious if you want to retrieve informations about a specific url (ruby code, translate to whatever works for you):


require 'rubygems'
require 'json'
require 'open-uri'
require 'digest'

def get_tags(url)
  hash = Digest::MD5.hexdigest(url)
  open("http://badges.del.icio.us/feeds/json/url/data?hash=#{hash}") do |input|
    return JSON.parse(input.read)
  end
end

Now let’s put this code at work:


require 'pp'

pp get_tags("http://blog.logeek.fr/2008/1/19/a-beginner-s-guide-to-datawarehouse")

Here’s the output:


[{"title"=>"A Beginner's Guide to Datawarehouse",
  "hash"=>"1bd588b55d27f3c3faa60b048632a200",
  "url"=>"http://blog.logeek.fr/2008/1/19/a-beginner-s-guide-to-datawarehouse",
  "total_posts"=>82,
  "top_tags"=>
   {"rails"=>6,
    "datawarehousing"=>22,
    "activewarehouse"=>11,
    "datawarehouse"=>55,
    "db"=>8,
    "ruby"=>13,
    "datamining"=>19,
    "database"=>32,
    "data"=>13,
    "guide"=>15}}]

So here my datawarehouse article has been bookmarked 82 times, most of the time with the keywords ‘datawarehouse’ and ‘database’.

The comments system is brand new - don't be afraid to comment!