Wikipedia 'Today's featured article' RSS Feed
As with quite a few of you out there, I like Wikipedia.
Awhile ago I wrote a script that would email you out the daily featured article. The cool people at Wikipedia got wind of that and actually created that
feature on their site.
With quite a few others of you, I also like RSS. So I figured why not put the two of these together so that I can get this in my
aggregator (bloglines.com ).
Well. Here it is. As you can see the script is pretty simple mod of the original. If you want you can run this on your own server, or
just subscribe here.
If we're lucky, the wikipedia people will start providing this themselves. Until then...
Enjoy.
source
#!/usr/bin/perl
#
# Get the Article of the Day from Wikipedia and make an RSS feed out of it.
#
#
# Author: Cameron Mallory http://berserk.org
#
# You may use this code below as you see fit, in any form whatsoever.
#
$wget = "/usr/bin/wget";
use XML::RSS;
my $rss = XML::RSS->new( version => '1.0' );
$rss->channel(
title => "Wikipedia RSS by berserk.org",
link => "http://en.wikipedia.org",
description => "Today's featured article from wikipedia.org",
master => "webmaster@berserk.org"
);
##
## Don't need to change anything below this
##
$data = `$wget -q -O - http://en.wikipedia.com`;
$data =~ s/\n/ /g;
$data =~ s/a href="/a href="http:\/\/en.wikipedia.com/g;
$match = "";
if ($data =~ /<h3>Today's featured article<\/h3>(.*?)<p>Recently featured:/ ){
$match = $1;
$rss->add_item( title => $rss->{channel}->{title} ,
link => $rss->{channel}->{link},
description => $match );
$rss->save("/full/path/to/your/directory/here/index.xml");
}
|