O'Reilly Hacks
oreilly.comO'Reilly NetworkSafari BookshelfConferences Sign In/My Account | View Cart   
Book List Learning Lab PDFs O'Reilly Gear Newsletters Press Room Jobs  



HACK
#87
Google Whacking
With over 2 billion pages in its index, is it possible to get only one result for a search?

Contributed by:

[03/13/03 | Discuss (135) | Link to this hack]

With an index of over 2 billion pages, Google attracts lots of interest from searchers. New methods of searching are tested, new ways of classifying information are explored, new games are invented.

New games are invented? Well, yes, actually. This is the Internet, after all.

The term "Google whacking" was coined by Gary Stock. The idea is to find a two-word query that has only one result. The two words may not be enclosed in quotes (that's too easy), and the words must be found in Google's own dictionary (no proper names, made-up words, etc). If the one result comes from a word list, such as a glossary or dictionary, the whack is disqualified.

If you manage a Google whack—and its harder than it sounds—be sure to list your find on the official Whack Stack (http://www.googlewhack.com/). Perusing the most recent 2,000 whacks is highly recommended if your brain is stuck and you need a little inspiration in your research. Examples include "endoscopy cudgels," "nebbish orthodontia," and "peccable oink."

Are you stuck for a Google whack query? This hack should help. It takes a random word from each of two "word of the day" sites and queries Google in hopes of a Google whack (or as experienced players would say, "To see if they make a whack").

#!/usr/local/bin/perl
# google_whack.pl
# An automated Google whacker.
# Usage: perl google_whack.pl

# Your Google API developer's key
my $google_key='insert key here';

# Location of the GoogleSearch WSDL file
my $google_wdsl = "./GoogleSearch.wsdl";

use strict;

# Use the SOAP::Lite and LWP::Simple Perl modules
use SOAP::Lite;
use LWP::Simple;

# Generate some random numbers to be used as dates for choosing 
# random word one.
srand(  );
my $year  = int( rand(2) ) + 2000;
my $month = int( rand(12) ) + 1; 
$month < 10 and $month = "0$month";
my $day = int( rand(28) ) +1;
$day < 10 and $day = "0$day";

# Pulling our first random word from Dictionary.com
my $whackone = 
  get("http://www.dictionary.com/wordoftheday/archive/$year/$month/$day.html") 
  or die "Couldn't get whack word 1: $!";
($whackone) = 
  ($whackone =~ /<TITLE>Dictionary.com\/Word of the Day: (.*)<\/TITLE>/i);

# Generate a new year between 1997 and 2000 for choosing
# random word two
srand(  );
$year  = int( rand(5) ) + 1997;

# Pulling our second random word from th  now defunct Maven's 
# Word of the Day (thank goodness for archives)
my $whacktwo = 
  get("http://www.randomhouse.com/wotd/index.pperl?date=$year$month$day") 
  or die "Couldn't get whack word 2:: $!";
($whacktwo) = ($whacktwo =~ m!<h2><B>(.*)</b></h2>!i);

# Build our query out of the two random words
my $query = "$whackone $whacktwo"; 

# Create a new SOAP::Lite instance, feeding it GoogleSearch.wsdl
my $google_search = SOAP::Lite->service("file:$google_wdsl");

# Query Google
my $results = $google_search -> 
    doGoogleSearch(
      $google_key, $query, 0, 10, "false", "",  "false",
      "", "latin1", "latin1"
    );

# A single result means a possible Google whack
if ($results->{'estimatedTotalResultsCount'} == 1) {
  my $result = $results->{'resultElements'}->[0];
  print 
    join "\n",
      "Probable Google whack for $query",
      "Title: " . $result->{title}||'no title',
      "URL: $result->{URL}",
      "Snippet: " . $result->{snippet}||'no title',
      "\n";
}

# Anything else is Google jack 
else {
  print "Google jack for $query, with " . 
    $results->{'estimatedTotalResultsCount'}  . " results\n";
}

  • whacked!
    2004-12-30 11:48:05  ballet [View]

    sesquepedalian kitten
    • whacked!
      2005-04-05 11:04:13  Khleo [View]

      I found a google whack in my Country it's Canada.com
  • google whack
    2004-12-29 07:30:25  elkrobber [View]

    i got one!
    numatic osteopath
  • I got one!
    2004-12-28 08:58:32  AHCgooglewhack [View]

    I got a two word phrase that only comes up with one result, it is "preromanticism pyromaniac" another one I have is "preromanticism osteopathic" Hard, huh? Please send me something back.
  • where
    2004-06-09 08:05:21  nomis [View]

    whers the command line?

    #!/usr/local/bin/perl
    # google_whack.pl
    # An automated Google whacker.
    # Usage: perl google_whack.pl

    # Your Google API developer's key
    my $google_key='insert key here';

    # Location of the GoogleSearch WSDL file
    my $google_wdsl = "./GoogleSearch.wsdl";

    use strict;

    # Use the SOAP::Lite and LWP::Simple Perl modules
    use SOAP::Lite;
    use LWP::Simple;

    # Generate some random numbers to be used as dates for choosing
    # random word one.
    srand( );
    my $year = int( rand(2) ) + 2000;
    my $month = int( rand(12) ) + 1;
    $month < 10 and $month = "0$month";
    my $day = int( rand(28) ) +1;
    $day < 10 and $day = "0$day";

    # Pulling our first random word from Dictionary.com
    my $whackone =
    get("http://www.dictionary.com/wordoftheday/archive/$year/$month/$day.html")
    or die "Couldn't get whack word 1: $!";
    ($whackone) =
    ($whackone =~ /<TITLE>Dictionary.com\/Word of the Day: (.*)<\/TITLE>/i);

    # Generate a new year between 1997 and 2000 for choosing
    # random word two
    srand( );
    $year = int( rand(5) ) + 1997;

    # Pulling our second random word from th now defunct Maven's
    # Word of the Day (thank goodness for archives)
    my $whacktwo =
    get("http://www.randomhouse.com/wotd/index.pperl?date=$year$month$day")
    or die "Couldn't get whack word 2:: $!";
    ($whacktwo) = ($whacktwo =~ m!<h2>(.*)</h2>!i);

    # Build our query out of the two random words
    my $query = "$whackone $whacktwo";

    # Create a new SOAP::Lite instance, feeding it GoogleSearch.wsdl
    my $google_search = SOAP::Lite->service("file:$google_wdsl");

    # Query Google
    my $results = $google_search ->
    doGoogleSearch(
    $google_key, $query, 0, 10, "false", "", "false",
    "", "latin1", "latin1"
    );

    # A single result means a possible Google whack
    if ($results->{'estimatedTotalResultsCount'} == 1) {
    my $result = $results->{'resultElements'}->[0];
    print
    join "\n",
    "Probable Google whack for $query",
    "Title: " . $result->{title}||'no title',
    "URL: $result->{URL}",
    "Snippet: " . $result->{snippet}||'no title',
    "\n";
    }

    # Anything else is Google jack
    else {
    print "Google jack for $query, with " .
    $results->{'estimatedTotalResultsCount'} . " results\n";
    }
    • where
      2004-12-28 09:00:03  AHCgooglewhack [View]

      Command line?
    • where
      2004-06-09 08:13:14  nomis [View]

      #!/usr/local/bin/perl
      # google_whack.pl
      # An automated Google whacker.
      # Usage: perl google_whack.pl

      # Your Google API developer's key
      my $google_key='insert key here';

      # Location of the GoogleSearch WSDL file
      my $google_wdsl = "./GoogleSearch.wsdl";

      use strict;

      # Use the SOAP::Lite and LWP::Simple Perl modules
      use SOAP::Lite;
      use LWP::Simple;

      # Generate some random numbers to be used as dates for choosing
      # random word one.
      srand( );
      my $year = int( rand(2) ) + 2000;
      my $month = int( rand(12) ) + 1;
      $month < 10 and $month = "0$month";
      my $day = int( rand(28) ) +1;
      $day < 10 and $day = "0$day";

      # Pulling our first random word from Dictionary.com
      my $whackone =
      get("http://www.dictionary.com/wordoftheday/archive/$year/$month/$day.html")
      or die "Couldn't get whack word 1: $!";
      ($whackone) =
      ($whackone =~ /<TITLE>Dictionary.com\/Word of the Day: (.*)<\/TITLE>/i);

      # Generate a new year between 1997 and 2000 for choosing
      # random word two
      srand( );
      $year = int( rand(5) ) + 1997;

      # Pulling our second random word from th now defunct Maven's
      # Word of the Day (thank goodness for archives)
      my $whacktwo =
      get("http://www.randomhouse.com/wotd/index.pperl?date=$year$month$day")
      or die "Couldn't get whack word 2:: $!";
      ($whacktwo) = ($whacktwo =~ !m<h2>(.*)</h2>!i);

      # Build our query out of the two random words
      my $query = "$whackone $whacktwo";

      # Create a new SOAP::Lite instance, feeding it GoogleSearch.wsdl
      my $google_search = SOAP::Lite->service("file:$google_wdsl");

      # Query Google
      my $results = $google_search ->
      doGoogleSearch(
      $google_key, $query, 0, 10, "false", "", "false",
      "", "latin1", "latin1"
      );

      # A single result means a possible Google whack
      if ($results->{'estimatedTotalResultsCount'} == 1) {
      my $result = $results->{'resultElements'}->[0];
      print
      join "\n",
      "Probable Google whack for $query",
      "Title: " . $result->{title}||'no title',
      "URL: $result->{URL}",
      "Snippet: " . $result->{snippet}||'no title',
      "\n";
      }

      # Anything else is Google jack
      else {
      print "Google jack for $query, with " .
      $results->{'estimatedTotalResultsCount'} . " results\n";
      }
  • Check it:
    2004-05-31 21:51:53  What? [View]

    How fun it is to Whack a Whack

    ----solatium quoin----

    although I'm a little late on the game...
    • 3
      2004-05-31 22:00:42  What? [View]

      Or die trying...


      ---vincible fanfaronade---
    • 2-Check it:
      2004-05-31 21:56:44  What? [View]

      Still, I could beet you in numbers...

      ---pythoness neoteric---
      • 4th
        2004-05-31 22:06:05  What? [View]

        This is my fourth, right?

        So I'm not doing that bad...

        ---eximious nyet---

        It would be a challenge to beet you in numbers...
        • 5th
          2004-05-31 22:08:39  What? [View]

          If I can't beet you by numbers...

          How about time?

          ---nitid liverish---
          • 6th
            2004-05-31 22:12:26  What? [View]

            Have any of you gotten six in unter twenty?

            For now. maybe more later...

            ---kakistocracy suppurate---
            • 7th
              2004-05-31 22:14:56  What? [View]

              I think it's more like 7 in thirty...

              Now i am going to have to give it up.


              ---Canossa sniglet----
              • 8th
                2004-05-31 22:18:58  What? [View]

                I really have to give it up.

                It's kind of addictive!

                I think the official time is 8 in twenty-eight

                You can see my time stamps as well as I...

                ----florilegium uvarovite----
  • the fourth coming
    2004-03-12 04:14:36  tered [View]

    we bet you thought "yes ive defeated tered i am amazing" BUT NOOOOOOOOOOOO we have suceeded once again. dave you are the mud on our conjoined shoes (we are siamese twins)

    we will return shortly with more whackattacks

    but for now.............
    hatrick marsupial
    • dave the fake
      2004-03-24 04:42:46  tered [View]

      it appears that dave69 is ignorant and does not have the guts to achieve what terese has done so edith find a new googlewhacker cos im leaving you.

      enjoy.

  • !!!!!!!!!!!!!
    2004-03-12 03:49:16  dave69 [View]

    OOOOOOOOOOOOOOO!!! GET YOU CLEVER CLOGS!!!
    IM SO IMPRESSED...

    dave xxx
  • Hey look Tered!!
    2004-03-10 06:11:49  dave69 [View]

    Dont worry your not alone!
    I found a google whack today and thought of you:

    Sternpost platonism

    Enjoy.
    • the third coming
      2004-03-12 03:46:12  tered [View]

      radiatory trophoplast

      YOU ENJOY..........
  • It happened again...the second coming
    2004-02-25 04:21:05  tered [View]

    We said we'd back2whack and we are. Minutes after our first 2 triumphs we were astounded to find yet another whackage of the highest order. Yes brothers and sisters we found another and although you may doubt us, it too has one result and one result only...

    WUTHERING GYRATORY!!
    amen
  • Whackaday we're the best!!
    2004-02-25 04:12:27  tered [View]

    HAHAHAHAHAHAHAHAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAA!!!
    We found two in one sitting!HOORAH!!

    1. Sericulture endomorph
    2. Terraqueous autobus

    Need i say more...no i won't, except, we rule and u don't.
    Ciao for now, we'll be back2whack
    TERED
  • Found one!! HA
    2004-02-10 20:57:31  shaunf79 [View]

    Necro beastitly :) try it!!!
  • A GOOGle WHACK
    2004-01-25 00:07:37  xander123 [View]

    here is one i found its
    ballerina fishcake
  • ben is sexy and ive got 1
    2003-12-23 07:11:00  anonymous2 [View]

    try this - goggles physcology
    • it's wrong
      2004-01-15 04:07:35  anonymous2 [View]

      try this one it works every time.

      Starcube fart
    • Can you confirm this is a confirmed Google whack????
      2003-12-25 13:10:27  anonymous2 [View]

      Onomatapoeic dodgy
  • Zak found a GOOGLE WHACK
    2003-12-23 02:22:27  anonymous2 [View]

    Try this one: sternocleidomastoid organometal
    • Zak found a GOOGLE WHACK
      2004-01-05 14:31:44  anonymous2 [View]

      you cheating dictionary looking bastard
  • This is fun!
    2003-12-17 16:48:11  anonymous2 [View]

    Try:
    unimpuned racer
  • I found another one
    2003-12-11 17:51:06  anonymous2 [View]

    This one has both of the words in the Google list:

    "Hemispherical Decembrist" returns only one result.
  • I found one
    2003-12-11 17:46:50  anonymous2 [View]

    Although one of the words isn't in the google word list, it is in a few dictionaries:

    "pneumonoultramicroscopicsilicovolcanoconiosis lexicographical" returns only one result
  • < 5 mins
    2003-11-21 12:12:27  anonymous2 [View]

    what the hell is all the fuss about? It took less than 5 mins and a few words off the top of my head. Save your scriptings skills for something more worthwhile.

    Your search - nefarious confustication - did not match any documents.
    • < 5 mins
      2003-11-25 04:42:02  anonymous2 [View]

      Did you mean: calabash gargantua




      No standard web pages containing all your search terms were found.

      Your search - callabash gaegantua - did not match any documents.

      Suggestions:

      - Make sure all words are spelled correctly.
      - Try different keywords.
      - Try more general keywords.
      - Try fewer keywords.
  • jamming words together at random.
    2003-11-14 18:09:38  anonymous2 [View]

    indivisible lycanthropic
  • Synthetic Googlewhacks:
    2003-10-05 02:32:19  anonymous2 [View]

    To manufacture a Googlewhack, simply find two terms that give no results, and then post them here. Google spiders this page; you've created a Googlewhack.

    http://www.pyresite.da.ru
    • Synthetic Googlewhacks:
      2003-11-03 13:21:23  anonymous2 [View]

      Yeah, found one: plasmonic bolt :)
  • how to
    2003-08-29 18:24:08  anonymous2 [View]

    biogenetical conceptualization - did not match any documents
  • steven
    2003-08-19 18:53:50  anonymous2 [View]

    i have found yet another word with only 1 website frabilicious
    and codon4
    • how to
      2003-08-29 18:27:49  anonymous2 [View]

      biodegradable biogenetical - 2
    • john mcg
      2003-08-22 14:21:28  anonymous2 [View]

      and yet another one - remove the underscores to try out the words:

      b_i_o_g_e_n_e_t_i_c_a_l w_i_l_d_e_b_e_e_s_t
  • how to run
    2003-08-18 07:39:52  anonymous2 [View]

    How do you run this script? Do you need a server to run it?
    • how to run
      2003-10-15 03:53:50  anonymous2 [View]

      hello sir ,
      i would like to use the google search in my site database.what is the possiblities.give me the detailed descriptions
      edward from india
      • how to run
        2003-10-17 14:33:53  anonymous2 [View]

        You, sir, are a dolt.
  • Better Whacking tips
    2003-07-08 07:11:48  anonymous2 [View]

    When using such phrases as "cataract pettifogger", words such as "my, but, new, can, and, because, erase" can, and will reduce search results. Even with this whack posted, I created a new one out of it.
  • soooo anoying
    2003-06-27 09:16:30  anonymous2 [View]

    im afraid i gave up after 10 min and tried to find the most results, 'the' gives the most
    • soooo anoying
      2003-10-13 22:12:57  anonymous2 [View]

      'a' wins
  • Only 1
    2003-04-29 16:45:58  anonymous2 [View]

    try this my pussycatman
    • Only 1
      2003-06-12 17:48:02  anonymous2 [View]

      Ahem, didn't the article say that the search terms must be proper words?
  • get 2
    2003-04-29 16:42:18  anonymous2 [View]

    type my nalamina
  • One hit word
    2003-04-29 15:50:37  anonymous2 [View]

    If you type the word Poonstab into the google search engine, youll only get one page of over 2 billion.
    Luvnapkin@yahoo.com
    • One hit word
      2003-05-06 14:47:52  anonymous2 [View]

      not any more. there are now three results, including this page.
  • flaw
    2003-04-18 08:23:28  anonymous2 [View]

    The code is flawed. Some of the words of the day are actually phrases. This means that some queries will be on more than two words.
    Also, online 44, there's a syntax error. Switch the 'm' and the '!'.
    • flaw
      2003-04-28 13:46:04  anonymous2 [View]

      There is no syntax error on line 44. This guy doesn't know Perl.
      • flaw
        2003-06-11 08:30:41  anonymous2 [View]

        check the errata, and I'm not a guy.
        • flaw
          2003-06-12 17:52:03  anonymous2 [View]

          I assume you mean the part near "=~ m!". There is no syntax error here (perhaps they have already updated the web page to reflect the erratas). Also, if some of the words of the days are phrases, why don't you be such a smarty pants and write some code to fix this if you're so smart, so there, go on, the codes flawed, oooh, it's flawed, thanks for the info, so wocha gonna do 'bout it huh, smarty pants?
          • flaw
            2003-06-17 10:58:52  anonymous2 [View]

            http://www.oreilly.com/catalog/googlehks/errata/googlehks.confirmed
            • flaw
              2003-09-12 08:00:51  anonymous2 [View]

              this site is badly flawed.

              I tried to register a whack but it will not accept it although its own google check shqos the search engine rturns only one site for the two words.

              Don't believe it? Try this:

              http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=invisible+%2B+passepartou

              cut and past into google itself instead of this crappy site.

              flawed? It sure is.

              Whacker Cracker!


              • flaw
                2003-10-14 09:05:59  anonymous2 [View]

                invisible passepartou is a jack because passepartou isn't a real word.

                even if you meant invisible passepartout, its still a google jack! duh!
  • Scratch those whacks
    2003-04-10 00:12:29  anonymous2 [View]

    Note the examples of whacks you listed now make this article show up on Google, thus they are no longer whacks.
    • Rael Dornfest photo Scratch those whacks
      2003-04-10 17:00:50  Rael Dornfest | O'Reilly Author [View]

      Actually, if you notice, I couldn't even find a Google Whack in time to make it into the book, so those are all Google Jacks and already in Google.

      Try say that three times fast.
      • Scratch those whacks
        2003-04-30 12:20:51  anonymous2 [View]

        The whole concept is flawed, because as soon as someone reports a wack on googlewhack.com, google spiders the site, adds it to its index, and then returns more than one result for those words.

        They should set robots.txt on that site to exclude google so they are not polluting the water they drink from...
        • Scratch those whacks
          2003-10-14 09:04:12  anonymous2 [View]

          well duh!!!

          If you actually look at the site you will find that they DO do that. Try searching google for some of the Google whacks already listed... you'll see..!
          • Scratch those whacks
            2004-01-17 06:33:14  anonymous2 [View]

            sos ya dad
        • Scratch those whacks
          2003-07-07 10:11:38  anonymous2 [View]

          I thought the idea was to find the whacks, hunt them, down and kill them. Merely reporting them has that effect.

          Down with Whacks!
        • Scratch those whacks
          2003-06-12 17:45:32  anonymous2 [View]

          Um, what's the point? Once a whack is found it's found, who cares about perpetuating its existence. I'm pretty sure the people who run the web site have realised this, and I don't think they're losing sleep over it, although I'm losing sleep being frustrated that retards like you exist.
  • how to
    2003-04-09 17:15:40  anonymous2 [View]

    how would put that in to google? Yes i know i am a nOOb lol.
    • how to
      2003-04-11 14:12:32  anonymous2 [View]

      If you're talking about all that other stuff you don't. It's a program. To run it you'll have to get Perl at perl.com.
    • Rael Dornfest photo how to
      2003-04-10 17:02:08  Rael Dornfest | O'Reilly Author [View]

      Howdy,

      You'd simply type the 1+ words into the Google search box, e.g. cataract pettifogger

      Rael
      • how to
        2003-08-29 18:24:35  anonymous2 [View]

        biogenetical conceptualization - did not match any documents
        • how to
          2003-12-14 02:08:47  anonymous2 [View]

          It will now :)
          • Oh dear, ive just thought of something
            2004-01-10 09:05:52  anonymous2 [View]

            As Oreillynet.com has been added to the google search engine, this page appears on google. That means that all of the google Whackers on this page have been included, so are not Google Whackers any more!

            http://www.web-site.tk
            • Yes, but...
              2004-02-08 14:33:10  kfm [View]

              e_n-d_o-m_a-t_i-c_p-r_e-r_e-q_u-i_s-i_t-e

              Sorry, I had to...
              • HA HA HA got one !!!!!!!!!!
                2005-03-08 18:02:02  tjd1992 [View]

                castiplish car ohhhhhhhh yah try it :)
                • ok it was wrong heres 1
                  2005-03-08 18:11:05  tjd1992 [View]

                  cataplasm antiestablishmentarian i checked it
                  • Lookie at that
                    2005-04-05 13:19:00  Khleo [View]

                    weary drearry and Another one is kitterz critters
                    • Lookie at that
                      2005-12-21 07:51:32  ally_the_google_master [View]

                      Found one :)

                      jelopino beef

Showing messages 1 through 130 of 130.

O'Reilly Home | Privacy Policy

© 2007 O'Reilly Media, Inc.
Website: | Customer Service: | Book issues:

All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.