#!/usr/local/bin/perl
#use Getopt::Long;
$DEBUG = 0;
$LOCKERROOM = 0;
$noSpoFi = 1;
$preTable = 2;
$notpostTable = 1;
$tRow = 0;
$foundCompleteFirstBlankTR = 0;
$killThisTR = 0;
$killCR = 0;
$inTR = 0;
while (<>) {
chop;
if ($preTable) {
if ($noSpoFi) {
if (/SpoFi/) {
$noSpoFi = 0;
if ($DEBUG) {
print "\n";
}
}
} else {
# assert: ($preTable && !$noSpoFi)
if (/
\n";
}
parsestuff();
}
}
sub parsestuff {
my $barf = 0;
#
if (/ffffff\">/) {
if ($DEBUG) {
print "\n";
}
$killThisTR = $barf = 1;
} elsif ($killThisTR) {
if (/<\/tr/) {
$killThisTR = 0;
$barf = !$foundCompleteFirstBlankTR;
if ($DEBUG && !$foundCompleteFirstBlankTR) {
print "\n";
}
$foundCompleteFirstBlankTR = 1;
} else {
$barf = 1;
}
} else {
############
# Here's where there's stuff that will pass through. Maybe.
############
if (/clear\.gif/) {
$barf = 1;
}
if ($inTR && /^\s*$/) {
$barf = 1;
}
############
# Okay, HERE'S where there's stuff that will pass through.
############
if ($killCR || $LOCKERROOM) {
s/^\s*//;
$killCR = 0;
}
s/table width=.100../table/;
s/class=\"[^\"]\"//g;
s/class=.hdgreen.//g;
if (/]*>/| /g;
#if ($tRow < 2) {
# s/ | / | /;
#}
#
#s/ | (\d)/ | \1/;
if ($tRow != 222) {
s/ | / | /;
}
if ($tRow == 7) {
s/\s*<\/td>/ <\/td>/;
}
$tRow++;
}
#s/\/M\/eventhist/eventhist/g;
s/eventhist/http:\/\/fantasy.premierleague.com\/M\/eventhist/g;
s/\/M\/http/http/g;
s/href="\s+/href=\"/g;
s/\s+>/>/g;
if ($LOCKERROOM) {
s/\s\s+/ /g;
s/ |
\s*$/> /;
}
if (/href="*\s*$/) {
$killCR = 1;
}
#
############
# End that stuff.
############
}
if (!$barf) {
print $_;
print "\n" unless ($killCR || $LOCKERROOM);
}
}
print "\n";