Cover art in del.icio.us RSS feeds
Cool thing #2: Using rvw!, del.icio.us, RSS, Magpie and RSSWriter to add cover images from Amazon to your del.icio.us RSS feed (see this feed for an example).Magpie code:
require_once(MAGPIE_DIR.'rss_fetch.inc');
include("rss10.inc");
$rss = fetch_rss( "http://del.icio.us/rss/USERNAME" );
$channel = $rss->channel;
$out = new RSSWriter($channel['link'], $channel['title'], $channel['description']);
$out->useModule("content", "http://purl.org/rss/1.0/modules/content/");
foreach ($rss->items as $item) {
$subject_array = split(" ", $item['dc']['subject']);
$img_url = "";
$content = "";
foreach ($subject_array as $tag){
if (preg_match("/urn\:(asin|isbn)\:(.*)/", "$tag", $matches)){
$img_url = "http://images.amazon.com/images/P/$matches[2].02.MZZZZZZZ.jpg";
$content = "<img src=$img_url>".$item['description'];
}
}
$out->addItem($item['link'], $item['title'],
array("description" => $item['description'],
"content:encoded" => $content,
"dc:creator" => $item['dc']['creator'],
"dc:date" => $item['dc']['date'],
"dc:subject" => $item['dc']['subject']));
}
$out->serialize();
August 3, 2004
See http://www.bloglines.com/preview?siteid=388595 for an HTML view of the feed with the images visible.
Posted by: Lucas on August 3, 2004 7:39 PMThanks for this, it was just the info. I needed for a similar project.
Posted by: Chris on September 6, 2006 3:17 PMAll fields are optional, email address will not be shown; no HTML, URLs are automatically hyperlinked.

Comments