#!/usr/bin/perl use LWP::Simple; use XML::RSS; use HTML::Entities; use strict; use warnings; my @feeds = qw( http://del.icio.us/rss/tag/geo http://del.icio.us/rss/tag/geodata http://del.icio.us/rss/tag/gis http://del.icio.us/rss/tag/gps http://del.icio.us/rss/tag/maps http://del.icio.us/rss/tag/map http://del.icio.us/rss/tag/mapserver ); my $count = 50; my $delay = 5; my %items; for my $url (@feeds) { my $feed = get($url); next unless $feed; my $rss = XML::RSS->new(version => '1.0'); eval { $rss->parse($feed) }; next if $@; for my $item (@{ $rss->{items} }) { $items{$item->{link}} = $item; } sleep $delay; } my @recent = sort { $b->{dc}{date} cmp $a->{dc}{date} } values %items; for my $item (@recent > $count ? @recent[0 .. $count - 1] : @recent) { my $title = encode_entities( $item->{title} ) or next; my $desc = encode_entities( $item->{description} || $item->{dc}{subject} ) || ""; my $href = $item->{link}; print qq{
• $title
\n}; }