use zw;

#   <li class="clearfix">
#         <div  class="ftrimage"><a href="/s/ap/20050428/ap_en_mo/people_tina_fey/nc:790;_ylt=Au67acY1YVyGJYSniIRXHe8wFxkF;_ylu=X3oDMTBiMW04NW9mBHNlYwMlJVRPUCUl"><img src="http://us.news3.yimg.com/img.news.yahoo.com/util/anysize/164,http%3A%2F%2Fus.news2.yimg.com%2Fus.yimg.com%2Fp%2Fap%2F20050428%2Fcapt.emy15404280931.multimedia_6445199_emmys_emy154.jpg?v=1" width="100" height="164" border="0" alt="Tina Fey from 'Saturday Night Live' arrives at the 54th Annual Primetime Emmy Awards Sunday, Sept. 22, 2002, at the Shrine Auditorium in Los Angeles. Fey will be a presenter on the show. (AP Photo/Kim D. Johnson)"></a></div>
#      <a href="/s/ap/20050428/ap_en_mo/people_tina_fey/nc:790;_ylt=AifJByjxWzdtz7C15Cu690MwFxkF;_ylu=X3oDMTBiMW04NW9mBHNlYwMlJVRPUCUl">Tina Fey and Husband Expecting First Baby</a>
#        <em>AP - <span class=timedate>Thu Apr 28, 9:35 AM ET</span></em>      <p>NEW YORK - "Saturday Night Live" star Tina Fey has some breaking news of her own: The "Weekend Update" co-anchor and her husband are expecting their first child in September, according to People magazine.</p>
#   </li>

# url=(/s/ap/20050428/ap_en_mo/people_tina_fey/nc:790)
# img=(clear.gif)
# imgalt=()
# hdl=(<img src="http://us.news3.yimg.com/img.news.yahoo.com/util/anysize/164,http%3A%2F%2Fus.news2.yimg.com%2Fus.yimg.com%2Fp%2Fap%2F20050428%2Fcapt.emy15404280931.multimedia_6445199_emmys_emy154.jpg?v=1" width="100" height="164" border="0" alt="Tina Fey from 'Saturday Night Live' arrives at the 54th Annual Primetime Emmy Awards Sunday, Sept. 22, 2002, at the Shrine Auditorium in Los Angeles. Fey will be a presenter on the show. (AP Photo/Kim D. Johnson)">)
# dte=(Thu Apr 28, 9:35 AM ET)
# blb=(NEW YORK - "Saturday Night Live" star Tina Fey has some breaking news of her own: The "Weekend Update" co-anchor and her husband are expecting their first child in September, according to People magazine.)

sub yahooUnifiedHandler
{
   my $html = shift;
   my( @rValue ) = ();


   # jjmac: (2005.04.28) To begin with, we'll ignore the 'top' story.  It's a
   # mess.
   while(
      $html =~
      /<li>.*?<div\ class="hd">.*?
      ([^<]*<div\s+class="ftrimage">.*?<img\ src="(.*?)"\ .*?\ alt="(.*?)"><\/a><\/div>)? # img, imgalt
      [^<]*<a\ href="(.*?)">(.*?)<\/a>                  # url, headline
      .*?<abbr\ title=.*?>(.*?)<\/abbr> # date
      .*?<p>(.*?)<\/p>                                # blurb
      .*?<\/li>
      /gixs
   )
   {  
      #print STDERR "1 = [$1]\n";
      #print STDERR "2 = [$2]\n";
      #print STDERR "3 = [$3]\n";
      #print STDERR "4 = [$4]\n";
      #print STDERR "5 = [$5]\n";

      my $image      = $2;
      my $imgalt     = $3;
      my $url        = $4;
      my $headline   = $5;
      my $date       = $7;
      my $blurb      = $8;
      if ($image =~ /^$/)
      {
         $image = "clear.gif";
      }
#      print STDERR "url=($url)\n";
#      print STDERR "img=($image)\n";
#      print STDERR "imgalt=($imgalt)\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,
         'ialt' => $imgalt,
         'image' => $image
      };
   }

#   print "exiting yahooUnifiedHandler\n";
#   exit;
   return @rValue;
}
# --   $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, "<table", "</table>" );
# --      print "story block: $storyBlock\n";
# --      exit;
# --      $storyBlock =~ s/<a href=".*?add.my.yahoo.*?".*?>//g;
# --      if( $storyBlock =~ /<a\ href="(.*?)"
# --                           (><img\ src="(.*?)"\ .*?><\/a>.*?)?
# --                           .*?class=topstory>(.*?)<\/a>
# --                           .*?<div\ class=.*?timedate>
# --                           (.*?)<\/div>
# --                           # .*?(<font\ size=-1>)?
# --                           (.*?) # (<\/font>)?.*?
# --                           <br\ clear=all>
# --                           /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\ href="(.*?)"
# --      (><img\ src="(.*?)"\ .*?><\/a>.*?)?
# --      .*?class=(topstory|reg)>(.*?)<\/a>
# --      .*?<div\s*?class=.*?timedate>.*?
# --      (.*?)<\/div>
# --      (.*?)<br\ clear=all>
# --      /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:

