View Single Post
Old 09-10-2004, 01:12 PM   #7
aranpura
Member
aranpura began at the beginning.
 
aranpura's Avatar
 
Posts: 12
Karma: 34
Join Date: Sep 2004
Location: San Francisco, California
Device: Tungsten T3
perl code for parseMediachannel.pl

#!/usr/pkg/bin/perl -w

#----------------------------------------------------------------
#--- this script depends on Perl modules installed at Freeshell
#----------------------------------------------------------------


$URL = "http://www.newsdissector.org/weblog/";

use LWP::Simple;
unless (defined ($webPage = get $URL)) {
die "could not get $URL\n";
}

#--- cut the header information and all the left/top nav
$webPage =~ s/<head>.*?(<font color="#CC0000")/$1/s;

#--- cut the right nav boxes and ads
$webPage =~ s/<table.*?bgcolor="#FFCC00".*(<font.*?color="#00000 0">)/$1/s;

#--- cut the footer information
$webPage =~ s/(Posted by.*?<\/font>).*(<\/body>)/$1\n$2/s;


#--- return the result to a browser CGI query
print "Content-type:text/html\n\n";
print $webPage;
aranpura is offline