Del.icio.us Links On Your Blog
November 10th, 2004
Ever since I started using del.icio.us, I wanted to use my links as a replacement to the recent links section on my side bar, which were just Movable Type entries assigned to a “Recent Links” category. I found several ways of doing it using third-party services, but in the end decided to use a method that relied less on third-party services.
Jeffrey Veen’s tutorial on using a feed parsing service like bigbold.com’s rss digest for displaying del.icio.us links on your blog seemed like the easiest method. Phil Windley also uses this method, but uses Feedsplitter instead. I did that, but I didn’t like the fact that with each page view would result in a call to del.icio.us and bigbold.com. So instead of using bigbold.com, I opted to use MagpieRSS. This results in one less call to a third party and MagpieRSS can use caching so I don’t even have to hit del.icio.us each time if I don’t want to.
Here is the code if you’re interested:
<?php
define('MAGPIE_DIR', '/path/to/magpie/');
require_once(MAGPIE_DIR.'rss_fetch.inc');
$num_items = 10;
$url = "http://del.icio.us/rss/sweeting";
$rss = @fetch_rss( $url );
if($rss) {
$items = array_slice($rss->items, 0, $num_items);
echo "<ul>";
foreach ($items as $item) {
$href = $item['link'];
$title = htmlentities($item['title']);
$description = htmlentities($item['description']);
echo "<li><a href="$href" title="$description">$title</a></li>\n";
}
echo "</ul>";
}
else {
echo "<p>There was a problem fetching the latest links from <a href="http://del.icio.us/sweeting">del.icio.us</a></p>\n";
}
?>
December 6th, 2004 at 3:00 pm
I know it’s not really relevant now, but RSS Digest also caches. It has 304 conditional GET support too, so del.icio.us gets called the least amount of times necessary, and not on every call :-)
December 7th, 2004 at 7:27 am
I found it easier, to just pull my bookmarks via a cron job, and parse the xml using php’s xml functions. This way the hits to del.icio.us could be scheduled as frequently as I wanted updates, and cause less lag for users who may be wanting to see my bookmarks. Right now though, I’m using a straight pull using curl, whereas, I’d like to write up a little pearl (or php) script that would react to error codes and such, so that if del.icio.us is unavailable, my bookmarks aren’t toast for an hour.
February 1st, 2005 at 1:01 am
Thank you! This is by far the cleanest and easiest to use method I’ve been able to get work, without calling del.icio.us too much; I’m really starting to love Magpie, and wanted to make better use of del.icio.us RSS feature, and I’ve tried so many different methods! Thanks!
July 12th, 2005 at 2:04 pm
Excellent, that was really well explained and helpful
Casa da Gioco