just follow the instructions on this page:
http://badsegue.org/archives/2005/03/21 ... ge-grabberin other words:
1. download this text and save it into a file called get.pl
Code:
use HTML::Parser;
use HTTP::Request::Common;
use LWP;
use URI::Escape;
use strict;
$|=1;
my $client = LWP::UserAgent->new(agent=>'Mozilla', timeout=>'0', keep_alive=>1);
my $ua = "Mozilla";
my $in = "./";
my $query = shift; chomp($query);
my $start_idx = shift; chomp($start_idx);
my $end_idx = shift; chomp($start_idx);
my $url = "http://images.google.com/images?q=$query+filetype:jpg\&safe=off";
my $start = $start_idx || "0";
my $stop = $end_idx || 0;
my $dest_dir = "$in/" . uri_escape ($query);
my $count = 1;
my $p = new HTML::Parser (
api_version => 3,
start_h => [\&tag, "tagname, attr"],
);
print "Start = $start, Stop = $stop, Query = $query\n";
mkdir $in || die "Couldn't make $in ($!)\n";
mkdir $dest_dir || die "Couldn't make $dest_dir ($!)\n";
while (1) {
my $test = $start;
# Get the search results page
my $request = HTTP::Request->new('GET', "${url}\&start=${start}");
my $response = $client->request($request);
$p->parse( $response->content );
# See if we are out of images
if ($test == $start || ($stop && ($start >= $stop))) {
print "Done.\n";
exit 0;
}
}
sub tag {
my ($tagname, $attr) = (@_);
# Found the next page graphic, increment counter to continue grabbing
if ($attr->{'src'} && ($attr->{'src'} eq "/nav_next.gif" )) {
$start += 20;
}
return unless ($tagname eq 'img');
return unless ($attr->{'src'} && $attr->{'src'} =~ /images\?q=tbn:.*\.jpg/i);
my $filename = $attr->{'src'};
$filename =~ s/\/images\?q=tbn:.*://;
$filename = uri_escape($filename);
if (-e "$dest_dir/$filename") {
print "Skipping ";
} else {
my $request = HTTP::Request->new('GET', "http://images.google.com$attr->{'src'}");
my $response = $client->request($request, "${dest_dir}/${filename}");
}
print "$filename (", $count++, ")\n";
}
2. install the program ActivePerl and say Yes for the associations of the .PL extension to ActivePerl.
3. from the command line where the get.pl is located execute the command:
get.pl \"flower\" 0 100
Note: to get the command line prompt use Start/Run... and insert "cmd.exe"
byeee
Andrea