Compare Google’s Results with Other Search Engines

Compare Google search results with results from other search engines.

True Google fanatics might not like to think so, but there’s really more than one search engine. Google’s competitors include the likes of Teoma and Yahoo!.

Equally surprising to the average Google fanatic is the fact that Google doesn’t index the entire Web. There are, at the time of this writing, over eight billion web pages in the Google index, but that’s just a fraction of the Web. You’d be amazed how much nonoverlapping content there is in each search engine. Some queries that bring only a few results on one search engine bring plenty on another search engine.

This hack gives you a program that compares counts for Google and several other search engines, with an easy way to plug in new search engines that you want to include. This version of the hack searches different domains for the query, in addition to getting the full count for the query itself.

Tip

This hack requires the LWP::Simple (http://search.cpan.org/search?query=LWP%3A%3ASimple) module to run.

The Code

Save the following code as a CGI script ["How to Run the Hacks” in the Preface] named google_compare.cgi in your web site’s cgi-bin directory:

#!/usr/local/bin/perl
# google_compare.cgi
# Compares Google results against those of other search engines.
     
# Your Google API developer's key.
my $google_key='insert key here'; # Location of the GoogleSearch WSDL file. my $google_wdsl = "./GoogleSearch.wsdl"; ...

Get Google Hacks, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.