#!/usr/bin/perl
# Time-stamp: "2008-05-31 22:21:08 ADT"
#
# See http://www.interglacial.com/rss/ for info on RSS feeds
#

require 5;
use strict;
use constant DEBUG => $ENV{'MAILTO'} ? 0 : 2;

use XML::RSS::SimpleGen 12;
my $url = "http://www.pbs.org/search/search_programsaz.html?station=KTOO";
rss_new( $url, "New PBS programs" );
rss_daily();
rss_history_file("pbs_programs.dat");
rss_webMaster('sburke@cpan.org');
rss_language("en-US");
rss_item_limit(20);

rss_self_url(      "http://interglacial.com/rss/pbs_programs.rss" );
rss_generator_url( "http://interglacial.com/rss/pbs_programs.pl" );
rss_livejournal( 'pbs_programs' );


DEBUG and print "\nGetting $url\n";
get_url($url);
DEBUG > 2 and print "Got: {{\n$_\n}}\n\n";

while(
  m{^<li><A HREF="(http://[^<>"]+)">([^\n]*?)</A>}img
) {
  DEBUG > 1 and print "  $1 : $2\n";
  rss_item( $1, $2 );
}

unless( rss_item_count ) { print "$0: No programs in $url !?\n{{\n$_\n}}\n"; }

rss_save( 'pbs_programs.rss', 45 );


