{
  "attachments": [],
  "comments_archived": true,
  "date": "2003-11-21T14:47:10.000Z",
  "layout": "post",
  "title": "Publishing Quick Links in blosxom with del.icio.us via xmlstarlet",
  "wordpress_id": 509,
  "wordpress_slug": "delicious-quicklinks",
  "wordpress_url": "http://www.decafbad.com/blog/?p=509",
  "year": "2003",
  "month": "11",
  "day": "21",
  "isDir": false,
  "slug": "delicious-quicklinks",
  "type": "entry",
  "postName": "2003-11-21-delicious-quicklinks",
  "html": "<p>\nIn case anyone is interested in using <a href=\"http://del.icio.us/\">del.icio.us</a> with <a href=\"http://www.blosxom.com\">blosxom</a> in place of my own <a href=\"http://www.decafbad.com/twiki/bin/view/Main/BookmarkBlogger\">BookmarkBlogger</a>, get yourself a copy of <a href=\"http://xmlstar.sourceforge.net/\">xmlstarlet</a> and check out this shell script:\n</p>\n<textarea rows=\"14\" cols=\"70\">#!/bin/bash\n\n&lt;p&gt;DATE=${1-&lt;code&gt;date +%Y-%m-%d&lt;/code&gt;}\nBLOG=\"/Users/deusx/desktop/decafbad-entries/links\"\nFN=\"${BLOG}/\"&lt;code&gt;echo ${DATE} | sed -e 'y/0123456789-/oabcdefghij/'&lt;/code&gt;\".txt\"&lt;/p&gt;\n&lt;p&gt;curl -s -u deusx:HAHAHA '&lt;a href=\"http://del.icio.us/api/posts/get?dt='$%7BDATE%7D\"&gt;http://del.icio.us/api/posts/get?dt='${DATE}&lt;/a&gt; |&lt;br&gt;    tidy -xml -asxml -q -f /dev/null |&lt;br&gt;    xml sel -t -o \"Quick Links\" -n &lt;br&gt;            -e 'ul'  -m '//post' &lt;br&gt;            -e 'li'  -e 'a' -a 'href' -v '@href' &lt;br&gt;            -b -v 'text()' -n  &gt; ${FN}&lt;/p&gt;\n&lt;p&gt;touch -d \"${DATE} 23:59\" ${FN}\n</textarea><p></p>\n<p>\nYou could do this with XSLT, but hacking with a REST-ish &amp; 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.\n</p>\n<p>\n<b>Update:</b> 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.\n</p>\n\n\n<!--more-->\n\n\n<p>shortname=delicious_quicklinks</p>\n<div id=\"comments\" class=\"comments archived-comments\"><h3>Archived Comments</h3>\n<ul class=\"comments\">\n<li class=\"comment\" id=\"comment-221086678\">\n<div class=\"meta\">\n<div class=\"author\">\n<a class=\"avatar image\" rel=\"nofollow\" href=\"http://24.102.209.201/weblogs/ben/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=588bdfdda82be46c638d6956c55ebc38&amp;size=32&amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png\" width=\"\" height=\"\"></a>\n<a class=\"avatar name\" rel=\"nofollow\" href=\"http://24.102.209.201/weblogs/ben/\">Gnomon</a>\n</div>\n\n\n<p><a href=\"#comment-221086678\" class=\"permalink\"><time datetime=\"2003-11-21T10:36:01\">2003-11-21T10:36:01</time></a></p>\n</div>\n\n\n<div class=\"content\">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 &amp;#036; to represent $ instead.</div>\n\n\n</li>\n<li class=\"comment\" id=\"comment-221086679\">\n<div class=\"meta\">\n<div class=\"author\">\n<a class=\"avatar image\" rel=\"nofollow\" href=\"\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=b2083fa8a0f60df479da38dbc1256def&amp;size=32&amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png\" width=\"\" height=\"\"></a>\n<a class=\"avatar name\" rel=\"nofollow\" href=\"\">Yay</a>\n</div>\n\n\n<p><a href=\"#comment-221086679\" class=\"permalink\"><time datetime=\"2003-12-05T20:01:13\">2003-12-05T20:01:13</time></a></p>\n</div>\n\n\n<div class=\"content\">Hi,\nCute script. I changed the last line like this to remove the file if it has got no links:\nif test `cat ${FN} |wc -c` = 18; then rm ${FN}; else touch -d \"${DATE} 23:59\" ${FN}; fi</div>\n\n\n</li>\n</ul>\n\n\n</div>\n\n\n",
  "body": "<p>\r\nIn case anyone is interested in using <a href=\"http://del.icio.us/\">del.icio.us</a> with <a href=\"http://www.blosxom.com\">blosxom</a> in place of my own <a href=\"http://www.decafbad.com/twiki/bin/view/Main/BookmarkBlogger\">BookmarkBlogger</a>, get yourself a copy of <a href=\"http://xmlstar.sourceforge.net/\">xmlstarlet</a> and check out this shell script:\r\n</p>\r\n<textarea rows=\"14\" cols=\"70\">\r\n#!/bin/bash\r\n\r\nDATE=${1-`date +%Y-%m-%d`}\r\nBLOG=\"/Users/deusx/desktop/decafbad-entries/links\"\r\nFN=\"${BLOG}/\"`echo ${DATE} | sed -e 'y/0123456789-/oabcdefghij/'`\".txt\"\r\n\r\ncurl -s -u deusx:HAHAHA 'http://del.icio.us/api/posts/get?dt='${DATE} |\\\r\n\ttidy -xml -asxml -q -f /dev/null |\\\r\n\txml sel -t -o \"Quick Links\" -n \\\r\n\t\t\t-e 'ul'  -m '//post' \\\r\n\t\t\t-e 'li'  -e 'a' -a 'href' -v '@href' \\\r\n\t\t\t-b -v 'text()' -n  > ${FN}\r\n\r\ntouch -d \"${DATE} 23:59\" ${FN}\r\n</textarea>\r\n\r\n<p>\r\nYou 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.\r\n</p>\r\n<p>\r\n<b>Update:</b> 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.\r\n</p>\r\n<!--more-->\r\nshortname=delicious_quicklinks\r\n\r\n<div id=\"comments\" class=\"comments archived-comments\">\r\n            <h3>Archived Comments</h3>\r\n            \r\n        <ul class=\"comments\">\r\n            \r\n        <li class=\"comment\" id=\"comment-221086678\">\r\n            <div class=\"meta\">\r\n                <div class=\"author\">\r\n                    <a class=\"avatar image\" rel=\"nofollow\" \r\n                       href=\"http://24.102.209.201/weblogs/ben/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=588bdfdda82be46c638d6956c55ebc38&amp;size=32&amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png\"/></a>\r\n                    <a class=\"avatar name\" rel=\"nofollow\" \r\n                       href=\"http://24.102.209.201/weblogs/ben/\">Gnomon</a>\r\n                </div>\r\n                <a href=\"#comment-221086678\" class=\"permalink\"><time datetime=\"2003-11-21T10:36:01\">2003-11-21T10:36:01</time></a>\r\n            </div>\r\n            <div class=\"content\">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 &amp;#036; to represent &#036; instead.</div>\r\n            \r\n        </li>\r\n    \r\n        <li class=\"comment\" id=\"comment-221086679\">\r\n            <div class=\"meta\">\r\n                <div class=\"author\">\r\n                    <a class=\"avatar image\" rel=\"nofollow\" \r\n                       href=\"\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=b2083fa8a0f60df479da38dbc1256def&amp;size=32&amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png\"/></a>\r\n                    <a class=\"avatar name\" rel=\"nofollow\" \r\n                       href=\"\">Yay</a>\r\n                </div>\r\n                <a href=\"#comment-221086679\" class=\"permalink\"><time datetime=\"2003-12-05T20:01:13\">2003-12-05T20:01:13</time></a>\r\n            </div>\r\n            <div class=\"content\">Hi,\r\nCute script. I changed the last line like this to remove the file if it has got no links:\r\n\r\nif test `cat ${FN} |wc -c` = 18; then rm ${FN}; else touch -d \"${DATE} 23:59\" ${FN}; fi</div>\r\n            \r\n        </li>\r\n    \r\n        </ul>\r\n    \r\n        </div>\r\n    ",
  "parentPath": "./content/posts/archives/2003",
  "path": "2003/11/21/delicious-quicklinks",
  "summary": "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:\n\n#!/bin/bash\n\n<p>DATE=${1-<code>date +%Y-%m-%d</code>}\nBLOG=\"/Users/deusx/desktop/decafbad-entries/links\"\nFN=\"${BLOG}/\"<code>echo ${DATE} | sed -e 'y/0123456789-/oabcdefghij/'</code>\".txt\"</p>\n<p>curl -s -u deusx:HAHAHA '<a href=\"http://del.icio.us/api/posts/get?dt='$%7BDATE%7D\">http://del.icio.us/api/posts/get?dt='${DATE}</a> |<br>    tidy -xml -asxml -q -f /dev/null |<br>    xml sel -t -o \"Quick Links\" -n <br>            -e 'ul'  -m '//post' <br>            -e 'li'  -e 'a' -a 'href' -v '@href' <br>            -b -v 'text()' -n  > ${FN}</p>\n<p>touch -d \"${DATE} 23:59\" ${FN}\n\n\nYou 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.\n\n\nUpdate: 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.",
  "needsBuild": true,
  "prevPostPath": "2003/11/20/recipe-web-3",
  "prevPostTitle": "Building the Recipe Web III",
  "nextPostPath": "2003/11/26/the-memo",
  "nextPostTitle": "Didja get that memo?"
}