#!/usr/bin/perl
use strict;
use warnings;
use LWP;
use LWP::UserAgent;
use LWP::Simple;
use HTML::Tree;
use URI::Escape;
use URI::QueryParam;
use URI;
use Time::localtime;
use Time::Local;
my $root = '';
my $from;
my $to;
my $curdate;
my $querydate;
my $uri = URI->new('http:///newpage/dabenying/jmb.asp');
my $localfile;
my $locdir ;
my $tm;
my $tvid ;
$from = timelocal( 0, 0, 0, 5, 7, 2009 - 1900 );
$to = timelocal( 0, 0, 0, 10, 7, 2009 - 1900 );
mkdir($root);
for ( $tvid = 1 ; $tvid <= 7 ; $tvid++ )
{
$locdir = sprintf("%s/%d",$root,$tvid);
mkdir($locdir);
$curdate = $from;
while ( $curdate le $to )
{
$tm = localtime($curdate);
$querydate = sprintf("?ChannelID=%d&jmbDate=%04d-%02d-%02d",$tvid,$tm->year +1900,$tm->mon+1,$tm->mday);
$localfile = sprintf("%s/%04d%02d%02d.html",$locdir, $tm->year +1900,$tm->mon+1,$tm->mday);
$uri->query($querydate);
print $uri->as_string,"\n";
print $localfile,"\n";
getstore($uri->as_string, $localfile);
$curdate += 24 * 3600;
}
}
|