Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: check words popularity using Google

by jasonk (Parson)
on Mar 06, 2003 at 22:44 UTC ( #241022=note: print w/replies, xml ) Need Help??


in reply to check words' popularity using Google

You could make this much friendlier to Google's servers by using the SOAP interface, rather than loading the whole page just to get one number. There are even some perl interfaces to their SOAP system: Net::Google and DBD::google (DBD::google is a DBI wrapper around Net::Google, which makes Google act like a database, and you can do sql queries against it, it is seriously cool).

  • Comment on Re: check words popularity using Google

Replies are listed 'Best First'.
Re: Re: check words popularity using Google
by mooseboy (Pilgrim) on Mar 07, 2003 at 12:57 UTC

    Interesting, thanks for the suggestion. I haven't yet checked out the Google modules on CPAN, although I really must get round to doing it rather than just screen-scraping, as I do use Google pretty extensively in my work (journalist). In fact O'Reilly has a new book called Google Hacks which is coming out soon, and I believe quite a bit of the code in it will be in Perl.

Re: Re: check words popularity using Google
by mooseboy (Pilgrim) on Mar 08, 2003 at 08:49 UTC

    OK, here's a quick rewrite using SOAP::Lite instead of screen-scraping. Now I'm off to install Net::Google and DBD::google to see what they can offer!

    #!/usr/bin/perl use warnings; use strict; use SOAP::Lite; my $key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; die "Usage: goolies2 word1 word2\n" unless @ARGV; foreach my $query (@ARGV) { my $googleSearch = SOAP::Lite->service("file:GoogleSearch.wsdl"); my $result = $googleSearch->doGoogleSearch($key, $query, 0, 10, "f +alse", "", "false", "", "latin1", latin1"); print "$query returned about $result->{'estimatedTotalResultsCount +'} results.\n"; } __END__ sample output: heather nova returned about 136000 results. sheryl crow returned about 238000 results. avril lavigne returned about 463000 results.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://241022]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2021-07-27 00:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?