hebig.org/blog

>2004>November>08« Previous EntryNext Entry »

Integrating del.icio.us Quicklinks without cron

There are already various tutorials on the net describing ways to include del.icio.us links into a website or a weblog. Most of them rely on cron though, so here are my two cents for those who don't have cron (like me).

If you have cron, things are straightforward: have MagpieRSS fetch your del.icio.us RSS feed regulary, parse, write to file, include(); into website or post to blog via XML-RPC, done. Or, more elegantly, get links via the API, transform XML result via XSLT, write to file, include(); into website or post to blog via XML-RPC, done. Now without cron. My first idea was to check the age of the result file and re-do the parsing dance if it is older than x minutes when requested for inclusion. Too complicated, unelegant and unpleasant to watch for the user whose page request initiates the renewed parsing. New idea: Move the whole del.icio.us posting process to my own server:

Run a visually similar copy of del.icio.us HTML form from one's own server, post the new link to the del.icio.us server via its API, invoke local MagpieRSS parser upon HTTP 200/OK reply from the del.icio.us server, use MAGPIE_CACHE_AGE to throttle rebuilds to let's say once per 15 minutes even when submitting multiple links within that span of time, parse updated del.icio.us RSS file and write local file if MagpieRSS cache has expired, done.

This solution does not only seem to be somewhat elegant, but also leaves room to do just about anything before or after posting a new link to del.icio.us, namely to improve the somewhat basic default HTML posting form (keywords: have autocomplete, choose tags from clickable lists, show related and similar tags). Dietrich Ayala has written a PHP library for the del.icio.us API which looks like a good starting point. Testing the library will be step one, copying the default posting form step two (including validation, which is now your own task and no longer del.icio.us'), patching both together step three, bringing in "actions to do on successful link posting via the API" (for now, read: invoke MagpieRSS) step four. Stay tuned.

RELATED
del.icio.us links related to this blog entry

Share this entry via email - on Twitter - on delicious

Comments will be back soon.

Site Design is getting redone at the moment, so not everything might be in place yet.