use zUtil;

sub theverge_rss
{
   $html = shift;
   my( @rValue ) = ();
   my ( $title, $url );

   $html =~ s/&amp;/&/gixs;

   # Atom format: <entry>...<title>...<link href="...">
   while( $html =~ s/<entry>.*?<title[^>]*>(.*?)<\/title>.*?<link[^>]*href="([^"]+)"[^>]*\/>.*?<\/entry>//six )
   {
       $title = $1;
       $url = $2;

       # Clean CDATA
       $title =~ s/<!\[CDATA\[//gsi;
       $title =~ s/\]\]>//gsi;

       next if $title =~ /^\s*$/;

       push @rValue, {
           'headline' => $title,
           'url'      => $url,
       };

       undef($url);
       undef($title);
   }

   return @rValue;
}

1;
