use zUtil;

sub azcentral
{
    my $html = shift;
    my $outname = shift;
    my ( @rValue ) = ();
    my ( $title, $url, $blurb );

    print "---------------------------- azcentral --------------------------\n";
    print "html: $html\n";

    # $html =~ s/&amp;/&/gixs;
    # $html =~ s/&gt;/>/gixs;
    # $html =~ s/&lt;/</gixs;
    # print "hmtl: $html\n";

    while( $html =~ s/<div class="comic-display-name">.*?<span class="comic-name">(.*?)<\/span>.*?<span class="comic-date-r">(.*?)<\/span>.*?<\/div>.*?<img class="uclick-display" src="(.*?)"\/>//s )
    {
        $date=$2;
        $image=$3;

        print "azcentral Found image: $image\n";
        $image =~ s/http:\/\/comics.azcentral.com\///gsix;

        push @rValue, {
            'date' => $date,
            'description'  => $image,
        };
    }

    $resultHash = $rValue[0];
    $fetch_img=$resultHash->{'description'};

    print "running: wget \"$fetch_img\" -O /usr/local/zeddweb/zii/scratch/$outname";

    system( "wget \"$fetch_img\" -O /usr/local/zeddweb/zii/scratch/$outname");
    system( "chmod", "ugo+rw", "/usr/local/zeddweb/zii/scratch/$outname");

   # exit 1;

    return @rValue;
}

return 1;

