use LWP::UserAgent;my $agent = LWP::UserAgent->new();$agent->agent('Mozilla/5.0');my $search_term = 'camel';my $search = $agent->get('http://images.google.com.au/images?hl=en&btnG=Search+Images&q=' . $search_term ) || die "$!";my $google_code = $search->content();while ($google_code =~ m|<a href=/imgres\?imgurl=([^&]+).*?<img src=/images\?q=tbn:[^:]+:([\S]+)|g){print "original: $1;\nthumbnail: $2;\n"}
which gets the first page and the URLs of all the thumbnails displayed by Google and their original URLs. Exercise for the reader etc.
posted by Mikey-San at 11:05 PM on May 16, 2006