Migrating to del.icio.us

social bookmarksI’ve been keeping a list of low threshold, or daily links here for over a year. My links were largely inspired by Joshua Schachter’s link list (Muxway) which he later turned into the popular del.icio.us social bookmarks engine. I remember trying the system out not long after I started my linkstream, but for some reason the idea didn’t really grab me, and the interface didn’t provide me much more over Movabletype.

Somewhere along the line though, del.icio.us became a much more streamlined means of posting and categorizing links. Moreso it became an independent subculture that really embodies a zero threshold mentality of linking. The system really benefits from people having almost no impetus to adding URLs, and it accomplishes this (quite wisely) by taking away any sort of identity or soapbox that could be used to influence other users of the system (more on that in a post coming up later today). Anyway, what I’m trying to say is that I wanted to use del.icio.us. So I stopped posting my oddments and I started posting to my del.icio.us account.

Since then I’ve transferred my old links from Movabletype into del.icio.us and integrated my del.icio.us links into my weblog using some very hand Perl tools. More importantly I’ve kept all of the functionality of my old link list, including the ability to give credit to my source through a via link. Here’s how:

Exporting links from Movabletype

The first step in migrating to del.icio.us is exporting your old link database from Movabletype. This can be accomplished by creating a very simple template that transforms your links into a tab-delimited textfile. I stored my links in the body field of my Movabletype database, my title in the title field, and my description in the extended field. At the same time we want to export our dates in a format that is easily accepted by del.icio.us. My export script looks like this:

<MTEntries lastn=”600″><$MTEntryDate format=”%Y-%m-%dT%H:%M:%SZ”$> <$MTEntryTitle$> <$MTEntryBody strip_linefeeds=”1″$> <$MTEntryExtended strip_linefeeds=”1″$>
</MTEntries>

The strip_linefeeds tag guarantees that we won’t have any accidental carriage returns in our text. Make sure that the fields are separated by tabs and that there is only one carriage return in the entire template. If it works correctly, you should get a file that looks like this:

1999-03-28T12:15:00Z http://some.url/ some text
1999-03-29T18:05:23Z http://some.url/ some text

Importing into del.icio.us

Once you have a nice text file full of all of your links, with fields tab-delimited and rows line-delimited, we’re ready to import them into del.icio.us. This can be accomplished using Aaron Straup Cope’s perfect perl implementation of the del.icious api, Net::Delicious. The code is quite simple, but you can grab mine:

delicious_import.pl

This script also backs off of del.icio.us, importing only one link per second, per Joshua’s request. Note that the tags I’m submitting for each link are simply “import”. This will come in handy later when we retag. If you’ve been good enough to categorize your links, you could stick the category in the tags field.

Retagging your links

Assuming you weren’t using multiple categories for your links in Movabletype, you’ll want to add tags to your links so that they’re easier to find and integrated with the rest of your links. For this purpose, I created a simple little cgi widget that grabs the newest link tagged with your import tag and allows you to type in new tags to replace them with. Everything else about the link (date, title, extended description) stays the same. You can grab my retagging program:

retagger.cgi

It looks something like this:

delicious retagging cgi

Integrating with Movabletype

Okay, now your links are safely transferred to del.icio.us and you’ve retagged all of them for the utmost interoperability. How do you move your tags back to Movabletype? This part is probably best left up to the reader as an exercise since there have been so many suggested methods. Here are just a few:

Because everything has to be just right for me and I didn’t want to hit the del.icio.us server every time the page is loaded (god knows overstated would bring del.icio.us to its knees, ha), I have a simple script using Net::Delicious that is run hourly to generate some HTML:

delicious_recent.pl

I found it necessary to keep my references to my sources (through the via reference), so I adopted a special type of tag in del.icio.us which is essentially via:site where site is the actual url of the site, sans the http://. I use a special case to turn these into viable links to the source instead of to the del.icio.us category.

As with any of my code, use at your own risk, and please let me know if you have any questions.

64 thoughts on “Migrating to del.icio.us

Leave a Reply