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.

July 6th, 2007 at 11:17 am
Script works beautifully except when copy and pasting the script, the single quotes need to be replaced (did SmartyPants do this?) or you will get an error.
November 24th, 2007 at 5:45 pm
Trying this out but I’m getting the following error when I try to install rubyosa on Leopard:
Building native extensions. This could take a while…
ERROR: While executing gem … (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.
ruby extconf.rb install rubyosa
can’t find header files for ruby.
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/rubyosa-0.4.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/rubyosa-0.4.0/gem_make.out
Sadly I know nothing about Ruby! Any clues?
Cheers, Mike
November 25th, 2007 at 5:49 pm
Ignore my last post… I installed Ruby through Macports and installed rubyosa and xml-simple and now get these errors:
/opt/local/lib/ruby/gems/1.8/gems/rubyosa-0.4.0/lib/rbosa.rb:773:in `__send_event__’: application returned error: Data could not be coerced to the requested descriptor type (-1700) (RuntimeError)
from /opt/local/lib/ruby/gems/1.8/gems/rubyosa-0.4.0/lib/rbosa.rb:773:in `make’
from ./delruby.sh:10
from ./delruby.sh:9:in `each’
from ./delruby.sh:9
from ./delruby.sh:8:in `each’
from ./delruby.sh:8
I appreciate you like all of us will be a extremely busy but any feedback would be appreciated so I can get my bookmarks into Yojimbo.
Cheers,
Mike