Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Can someone provide an example or point me in the right direction?use warnings; use strict; use Data::Dumper; use REST::Google::Search; REST::Google::Search->http_referer('http://example.com'); SearchGoogle( 0 ); sub SearchGoogle { my $start = shift; #print "Looking from position: $start\n"; my $res = REST::Google::Search->new( q => 'perl regex', start => $start, rsz => 'small', ); if ( $res->responseStatus != 200 ) { SearchGoogle( $start ); } my $data = $res->responseData; my $cursor = $data->cursor; my $pages = $cursor->pages; printf "current page index: %s\n", $cursor->currentPageIndex; my @results = $data->results; my $found = 0; foreach my $r (@results) { if ($r->url =~ /spaweditor.com/) { $found = 1; print "FOUND WEBSITE: on page " . $cursor->currentPageIndex . +"\n"; exit; } } if ( !$found ) { $start += 4; SearchGoogle( $start ); } }
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: REST google search issues?
by Khen1950fx (Canon) on Jan 07, 2010 at 02:37 UTC | |
by Anonymous Monk on Jan 07, 2010 at 14:58 UTC | |
by Anonymous Monk on Jan 07, 2010 at 15:00 UTC | |
by Khen1950fx (Canon) on Jan 07, 2010 at 18:47 UTC |