Dr Nic

Exporting Netvibes bookmarks to Del.icio.us

For 12 months I’ve been using Netvibes to store bookmarks. A few weeks ago I started using Del.icio.us, which is also integrated into Netvibes. Now I had two sets of bookmarks. That’s one too many. Time to retire the Netvibes bookmark module, but how do I migrate/export the netvibes bookmarks, and how do I upload them to Del.icio.us?

“How to export Netvibes bookmarks?”

Exporting Netvibes bookmarks is a major request on their forum, so here is the answer.

  1. Login to Netvibes
  2. Go to address: http://www.netvibes.com/modules/bookmarks/getUserBookmarks.php?nocache=0
  3. Save the XML as netvibes_bm.xml

The XML should look something like:

  <link id="4401802" title=".htaccess generator" url="http://www.tools.dynamicdrive.com/password/" tags="unix"/>
  <link id="6444925" title="19 Rails Tricks Most Rails Coders Don't Know" url="http://www.rubyinside.com/19-rails-tricks-most-rails-coders-dont-know-131.html" tags="RoR"/>
  <link id="4436310" title="37signals - the tools we use ourselves" url="http://37signals.com/svn/archives2/the_tools_we_use_to_run_and_build_37signals.php" tags="business, ideas, RoR"/>

Note that your Netvibes tags are included. These will be uploaded into Del.icio.us too.

“How to upload Del.icio.us bookmarks?”

Now you are ready to upload these bookmarks into Del.icio.us (or modify it yourself to upload it wherever you want). I’ve written a script to do this using the Ruby programming language (dowload and install instructions here). Why? Because it took 10 minutes to do so. Feel free to rewrite it if you really want, but it’d be quicker to install Ruby, run the script, and move on with your life :)

  1. Install Ruby
  2. Install Hpricot [1]: type gem install hpricot (select the win32 version if you are on windows)
  3. Download the netvibes_delicious.rb script [2]
  4. Change the username and password values in the script to your del.icio.us username/password.
  5. Execute the script: ruby netvibes_delicious.rb netvibes_bm.xml
  6. The script will tell you how many bookmarks it will be uploading to Del.icio.us, and ask you to press return to continue. Press Ctrl-C to kill the script.

If you want to “test” the script first, create a copy of your netvibes_bm.xml file, and cut away all the <link ... > tags, except one or two. Check that the script works on these few bookmarks first, then rerun the script on the original file.

Now add the Del.icio.us module into Netvibes and remove the original Bookmarks module.

Tally ho.

[1] Hpricot is a brilliant library for parsing and processing HTML/XML data.

[2] The contents of the script:

['rubygems', 'hpricot', 'open-uri', 'net/https', 'cgi'].each {|lib| require lib}

# Netvibes bookmarks XML file
file = ARGV.shift
bookmarks = []

page = Hpricot(open(file))
page.search("//link").each do |link|
  bookmarks << {
    :title => link.get_attribute("title"),
    :description => link.get_attribute("title"),
    :url   => link.get_attribute("url"),
    :tags  => link.get_attribute("tags").split(', ').join(" "),
    :shared => "yes"

puts "Transferring #{bookmarks.length} bookmarks to Del.icio.us"
puts "Do it?"; gets

# Del.icio.us target for bookmarks
username = "" # your del.icio.us username
password = "" # your del.icio.us password

resp = href = "";

bookmarks.each do |bookmark|
    http = Net::HTTP.new("api.del.icio.us", 443)
    http.use_ssl = true
    http.start do |http|
      pp bookmark
      req = Net::HTTP::Post.new("/v1/posts/add",
        {"User-Agent" => "drnicwilliams.com Netvibes to Delicious"})
      req.basic_auth(username, password)
      req.set_form_data bookmark
      response = http.request(req)
      resp = response.body
      puts "#{Hpricot(resp).search('/result').first.get_attribute('code').humanize} -> #{bookmark[:title]}"

  rescue SocketError
    raise "Host " + host + " not accessible"

Related posts:

  1. Sentences with links I have suggested I’d release 0.9 many times on Google...
  2. 53 cheat sheets and growing I said previously that errtheblog’s cheat app would have 100s+...
  3. My .irbrc for console/irb The relatively unspoken warhorse of Ruby/Rails programming is the irb/console...
  4. Fixing your Feedburner feeds Feedburner is great – you get snazzy graphs [1]. And...

2 Responses to “Exporting Netvibes bookmarks to Del.icio.us”

  1. G says:

    Makes me wanna start using delicious so i can import my netvibes bookmarks!

  2. okakhwyjgs says:

    Thanks for this site!