Yesterday, I was quite surprised when I head rumors that Delicious, my favorite link sharing site, is shutting down. According to their blog, they are looking for a way to continue the service outside of Yahoo, but it’s better to be safe than sorry and backup all bookmarks.
I was never too fond of Delicious’ API, so I decided to use the manual export that dumps all its data except tag bundles to an HTML file (log into your account, then go to Settings, Bookmarks, Export). Since the format is a pre-XHTML tag soup that you can’t parse with an XML parser, I decided to use Beautiful Soup to extract the data and convert it to JSON. From this point on, it’s trivial to process it in whatever way I need.
Here’s the script, I have tested it on Python 2.6 and 2.7. Other versions may require some tweaking. It reads its data from standard input and writes it to standard output:
python delicious-to-json.py < delicious-20101217.htm > out.json
A few minutes after I wrote the script (duh!), I found an even better method that dumps all bookmarks in a nice XML format:
curl --user username:password -o bookmarks https://api.delicious.com/v1/posts/all
Parsing the dumped XML format is pretty simple, too.
I’m not sure where to move my bookmarks to, but I have a few requirements:
- I want good browser integration.
- I’d like to browse my friends’ bookmarks, so social features would be a plus.
- There must be an open, public API where I can import and export my data any time I choose.
Google Bookmarks doesn’t have an official API and after all, there’s enough data of mine at Google already. Xmarks sounds interesting for its browser synchronization but it doesn’t have an API either. Seems like I have to keep looking – or hope that Delicious continues its service.