Go to content Go to menu

Today I wanted to export my bookmarks from Google Reader so I could tag them in del.icio.us. I found that the easiest way to do it was to export my list of subscriptions to OPML and use Ruby's REXML library to extract the URLs that I wanted.

  1. First step, export your subscription list and save it as ~/greader.opml
  2. Run this Ruby script from ~:
    require "rexml/document"
    
    opml = REXML::Document.new(File.new( 'greader.opml' ))
    
    #REXML lets you use an XPath expression to select elements, then iterate over them
    sites = opml.elements.map('opml/body/outline/outline') do |outline|
      [ outline.attributes['text'], outline.attributes['htmlUrl'] ]
    end
    
    File.open( 'bookmarks.html', 'w' ) do |output_file|
      output_file << '<html><body>'
      
      sites.uniq.sort.each do |site|
        output_file << "<a href='#{site[1]}'>#{site[0]}</a> <br/>"
      end
      
      output_file << '</body></html>'
    end
  3. Now, you will have a file ~/bookmarks.html that lists all of the websites that you had RSS/Atom feeds to in Google Reader.

I opened my bookmarks.html file in my browser and used the del.icio.us extension to tag them all, but you can use them however you like.

Enjoy!