[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: libnet-google-perl



On Friday 09 July 2004 14:09, Klaus Becker wrote:
> Kann mir jmd das erklären?

Du kannst damit ein Perl skript schreiben das Google abfragen macht, ungefähr 
so:
 
 use Net::Google;
 use constant LOCAL_GOOGLE_KEY => "********************************";

 my $google = Net::Google->new(key=>LOCAL_GOOGLE_KEY);
 my $search = $google->search();

 # Search interface

 $search->query(qw(aaron straup cope));
 $search->lr(qw(en fr));
 $search->starts_at(5);
 $search->max_results(15);

 map { print $_->title()."\n"; } @{$search->results()};

 # or...

 foreach my $r (@{$search->response()}) {
   print "Search time :".$r->searchTime()."\n";

   # returns an array ref of Result objects
   # the same as the $search->results() method
   map { print $_->URL()."\n"; } @{$r->resultElements()};
 }

 # Spelling interface

 print $google->spelling(phrase=>"muntreal qwebec")->suggest(),"\n";

 # Cache interface

 my $cache = $google->cache(url=>"http://search.cpan.org/recent";);
 print $cache->get();

Weitere informationen gibt es unter 
http://search.cpan.org/~ascope/Net-Google-0.62/lib/Net/Google.pm

>
> tschüs
> Klaus

Grüße,
	Marcus

-- 
 :: Marcus Thiesen :: www.thiesen.org :: ICQ#108989768 :: 0x754675F2 :: 

That means I'll have to use $ans to suppress newlines now. Life is 
ridiculous. 
                                                                   Larry Wall

Attachment: pgp_tOcHjiINH.pgp
Description: signature


Reply to: