Simple XSLT and Delicious API

I decided I wanted to take five minutes today to implement a simple idea I’ve had for a long time. When I get home, I typically eat dinner while reading news in my RSS reader and I’ve found less and less time to write my own posts. I simply wanted to be able to bookmark the things I found interesting and have them automatically appear as a weblog entry.

Part one was getting the data from Delicious, which is the obvious choice for bookmarking. They make it really easy to get all bookmarks made on the last day of activity with a given tag with their posts/get function. To get all bookmarks I made today with a tag of “viewed”, I simply ran:

$ curl ‘https://minusnine:password@api.del.icio.us/v1/posts/get?dt=2009-04-07&tag=viewed' > todays.xml

which saves an XML form of the posts.

Transforming the XML into a list is a trivial task but I saw two approaches: sed would do nicely for the crufty old sysadmin in me, but XSLT satisfies the young whippersnapper in me.

The XSLT is very simple and elegant.

Combining these with xsltproc:

$ xsltproc posts.xsl todays.xml

yields a cut-and-pastable post. The next step is to pipeline these (also trivial) and upload it to my Wordpress installation.

Original work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License | © Eric Garrido