#use zw; sub yahooUnifiedHandler { $html = shift; $tableCount = shift; my $done; my $count; @rValue = (); # print "-------------- yahooUnifiedHandler ---------------\n"; if ($tableCount =~ /^$/) { $tableCount = 28; } $done = 0; $count = $tableCount; while( !$done ) { print "iteration .. count: $count..\n"; $storyBlock = zUtil::getNthItemNew( $count, $html, "" ); #print "story block: $storyBlock\n"; #exit; $storyBlock =~ s///g; if( $storyBlock =~ /<\/a>.*?)? .*?class=topstory>(.*?)<\/a> .*? (.*?)<\/div> # .*?()? (.*?) # (<\/font>)?.*? /ixs ) { # print "story block: $storyBlock\n"; # print "=================================================\n"; # exit; $done = 1; } else { # print "b"; $count++; if( $count > 50 ) { $done = 1; } } } # print "html($html)\n"; # print "storyBlock($storyBlock)\n"; # print "table=$tableCount\n"; # exit(); # Our performance sucks pretty bad. Let's try and help things out a bit. $storyBlock =~ s/(.*)More Stories.*/$1/s; # print STDERR "Processing story block...\n"; # print "storyBlock($storyBlock)\n"; # exit; while ( $storyBlock =~ / <\/a>.*?)? .*?class=(topstory|reg)>(.*?)<\/a> .*?.*? (.*?)<\/div> (.*?) /gixs ) { $image = $3; $url = $1; $headline = $5; $date = $6; $blurb = $7; if ($image =~ /^$/) { $image = "clear.gif"; } # print STDERR "url=($url)\n"; # print STDERR "img=($image)\n"; # print STDERR "hdl=($headline)\n"; # print STDERR "dte=($date)\n"; # print STDERR "blb=($blurb)\n"; # exit; push @rValue, { 'url' => $url, 'headline' => $headline, 'date' => $date, 'blurb' => $blurb, 'image' => $image }; } # print "exiting yahooUnifiedHandler\n"; return @rValue; } 1; # vi: set ts=3 sw=3 nowrap expandtab: