#!/usr/bin/perl -w # create-rss.pl # Function: Creating an RSS file based on the news section of munitions. # Author : Chris Ball # Creation: 2001-09-17/20:55 use XML::RSS; use LWP::Simple; use HTML::TokeParser; use strict; my $rss = new XML::RSS (version => '0.9'); my ($text, $url, $token); # Prep the RSS. $rss->channel( title => "munitions.printf.net", link => "http://munitions.printf.net", description => "munitions.printf.net - cryptographic software for linux",); # Download the HTML page. my $content = get("http://munitions.vipul.net/dolphin.cgi?action=index"); my $p = HTML::TokeParser->new( \$content ) or die "$!"; # For each tag on the page.. while ( $token = $p->get_tag("a") ) { if ($token->[1]{href} =~ /renderobject/) { # $url = an href matching renderobject. $url = $token->[1]{href} || "--"; # $text = the text up to the end of the tag of the renderobject. $text = $p->get_trimmed_text; # We need to escape &s, as they start entity references in XML. $url =~ s/&/&/g; # Add that to the XML. $rss->add_item( title => $text, link => $url); } } print $rss->as_string; $rss->save("munitions.rdf");