Publishing Quick Links in blosxom with del.icio.us via xmlstarlet

In case anyone is interested in using del.icio.us with blosxom in place of my own BookmarkBlogger, get yourself a copy of xmlstarlet and check out this shell script:

!/bin/bash

DATE=${1-date +%Y-%m-%d} BLOG=”/Users/deusx/desktop/decafbad-entries/links” FN=”${BLOG}/”echo ${DATE} | sed -e 'y/0123456789-/oabcdefghij/'“.txt”

curl -s -u deusx:HAHAHA ‘http://del.icio.us/api/posts/get?dt=’${DATE} |\ tidy -xml -asxml -q -f /dev/null |\ xml sel -t -o “Quick Links” -n \ -e ‘ul’ -m ‘//post’ \ -e ‘li’ -e ‘a’ -a ‘href’ -v ‘@href’ \ -b -v ‘text()’ -n > ${FN}

touch -d “${DATE} 23:59″ ${FN}

You could do this with XSLT, but hacking with a REST-ish & XML producing web service entirely in a shell script seemed oddly appealing to me that week. Extending this sort of thing to blogging systems other than blosxom is left as an exercise to the reader.

Update: Hmm, looks like one of the blosxom plugins I’m using hates the variables in my code above. So I stuck curly braces in, which seem to get through okay.

shortname=delicious_quicklinks

2 Comments

  1. Posted November 21, 2003 at 10:36 am | Permalink

    It’s probably the interpolate_conditional or interpolate_fancy plugin - it tends to dislike entries that contain dollar symbols. I’ve wrestled with it in the past, but now I don’t bother - I just use $ to represent $ instead.

  2. Yay
    Posted December 5, 2003 at 8:01 pm | Permalink

    Hi,
    Cute script. I changed the last line like this to remove the file if it has got no links:

    if test cat ${FN} |wc -c = 18; then rm ${FN}; else touch -d “${DATE} 23:59″ ${FN}; fi

Post a Comment

Your email is never shared. Required fields are marked *

*
*