Created
November 1, 2009 18:04
-
-
Save acotie/223638 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use WWW::Mechanize; | |
my $mech = WWW::Mechanize->new(); | |
$mech->agent("Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"); | |
$mech->add_header( 'Referer', "http://bijint.com/jp/" ); | |
my $base_url = 'http://www.bijint.com/binan/img/clk/'; | |
for my $h (0..23) { | |
for my $m (0..59) { | |
my $file_name = sprintf('%02d%02d.jpg', $h, $m); | |
my $image_url = $base_url . $file_name; | |
get_image($image_url, $file_name); | |
} | |
} | |
sub get_image { | |
my ($image_url, $file_name) = @_; | |
eval { | |
$mech->get($image_url, ":content_file" => $file_name); | |
}; | |
if( $@ ) { | |
print "retry!!¥n"; | |
get_image($image_url, $file_name); | |
} | |
} | |
exit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment