my $start = 1; my $end = 10; my $cnt = 0; for ($start..$end) { $cnt++; print "Current page count: $cnt
";
my $funky = "http://www.allpoetry.com/chat/page=$cnt;";
my $content = get($funky);
my $tree = HTML::Tree->new();
$tree->parse($content);
# retrieve the text and split into lines
my @lines = split "
", $tree->as_text;
local $/;
my @good_lines;
my $good_lines;
for my $lines (@lines) {
$lines =~ s/\)/\)
/g;
while($lines =~ m/Next Chatter \>(.*?)\< Previous Chatter/gs){
$good_lines = $1;
push @good_lines,$good_lines;
}
foreach (@good_lines){
my @lines = split /
/;
foreach (@lines){
next unless $_;
#m/^(.*?):(.*?) \((.*) (?:seconds|minute|minutes|hour|hours|day|days) ago\)$/;
#m/([^:]+): (.+)\((.*)\)/;
m/([^:]+): (.+)(\((.*)\))/;
my( $name, $text, $delay ) = ( $1, $2, $3 );
#print "NAME:$name\nText:$text\nDelay:$delay\n\n";
#if ($name =~ m/Elisabeth/) {
print "$name $text $delay
"; # $text $delay
"
#}
}
}
}
}