Friday, September 17, 2004

Yet Another DailyDelicious hack for WordPress

I wanted a nice simple way to mirror my daily bookmarks that I've added to [del.icio.us](http://del.icio.us) into [WordPress](http://www.wordpress.org)

Stephen Eyre's [dailydelicious](http://www.dot-totally.co.uk/dailydelicious.txt) was close, but
not exactly they way I wanted it. He used the RSS feed, but that doesn't give a good daily cutoff.

So, I present Yet Another Daily Delicious php script: [yadd.php](http://www.nozell.com/marc/blog/data/yadd-1.0.TXT).

It asks for just today's bookmarks using the published api, parses the XML, generates nicely formatted HTML and creates a WordPress entry.

Here is the writeup from the code:
- - -


This is yadd.php V1.0 by Marc Nozell (marc@nozell.com) based on
Stephen Eyre's dailydelicious
(http://www.dot-totally.co.uk/dailydelicious.txt)

See http://www.nozell.com/blog/ for the latest version of
'yet another daily delicious' (yadd.php)

USAGE:

1) Edit the section below. At the very least use your del.icio.us
username and password ($del_user/$del_password)

2) Put there file somewhere on the server where you run WordPress.

3) Arrange for this page to be hit once a day, say 11:30ish your
local time. del.icio.us seems to track UTC so depending on which
timezone you live in, some bookmarks from your yesterday may show
up. Consider using a simple cronjob that looks like this:

30 23 * * * $HOME/bin/yadd.sh

where yadd.sh looks like this:

#!/bin/bash
curl http://www.yoursite.com/yadd.php

4) In the morning edit the entry if you wish. I've tried to generate
pretty HTML so it will be simple to edit the entry.

THINGS TO KEEP IN MIND

Anyone that hits the URL for this script will cause your current
bookmarks to be dumped into WordPress. Clearly this is not
desirable.

You have some options. The easiest is to keep this URL 'secret'.
Name it something unusual and put it in a non-obvious place.
Remember that if you display your web hit stats, the url will be
exposed. A better solution to use .htaccess to limit access. If
you do that remember to update the url wget uses to include the
username/password, something like this:
curl http://someuser:somepassword@www.yoursite.com/yadd.php

Enjoy,

-marc