Sunday May 20th 2007, 2:30 am
By Theron Parlin
Tags: RubyOSA, Yojimbo, bookmarks, del.icio.us, import, rubySo I’ve been playing around with different information organizers. I recently wrote about Journler, which is a really good free option. However, after trying out the demo for Yojimbo, I decided to switch. One of the reasons I like Yojimbo is that it provides different content types in its posts (e.g. bookmarks, web archives, passwords, serial numbers and notes). As soon as I saw the bookmark option, I immediately started searching for a way to import all my del.icio.us bookmarks into Yojimbo. Unfortunately, I didn’t find anything, so I decided to write an import script.
The first thing I did was install RubyOSA, a gem that provides a bridge from Ruby to the Apple Event Manager. It allows Ruby programs to automate Mac OS X applications in the same way as AppleScript.
-
$ sudo gem install rubyosa
After that I went to the following URL to download all of my del.icio.us links into a single XML file:
https://api.del.icio.us/v1/posts/all (you’ll be prompted for your del.icio.us username and password) Once you see your bookmarks, go to file->save and save the file as all.xml. Open the xml file you just created and change the second line from this:
<posts update=”2007-05-19T23:44:07Z” user=”username”>
to
<posts>
Then, just use the following script to import your bookmarks from del.icio.us to Yojimbo:
-
require ‘rubygems’
-
require ‘rbosa’
-
require ‘xmlsimple’
-
myconfig = XmlSimple.xml_in("all.xml", {})
-
app = OSA.app(‘Yojimbo’)
-
-
myconfig.each { |posts|
-
posts[1].each { |post|
-
bookmark = app.make(OSA::Yojimbo::BookmarkItem, with_contents=nil, with_properties=nil)
-
bookmark.name=post[‘description’]
-
bookmark.location=post[‘href’]
-
bookmark.comments=post[‘extended’]
-
tags = post[‘tag’].split(/ /)
-
tags.each {|t| app.add_tags(t, bookmark)}
-
}
-
}
It’s possible you’ll need to install XmlSimple to get the script working. For some reason, installing the XmlSimple gem wasn’t enough, I had to download version 1.0.6 and run:
-
ruby install.rb config
-
ruby install.rb setup
-
ruby install.rb install
Good luck.

