Hacking Google Suggest
Google’s Suggest feature is lighting up the blogosphere these days. It functions as like autocomplete for your search box, where Google attempts to determine what you are searching for and gives you suggestions. Web tinkerer that I am, I had to dig in a little and see how this works.
At its simplest, Google Suggest is javascript code that looks at what you are typing in the Google search box. When you press a key, GS phones home and passes the current contents of the search box. The server returns some suggestions are then displayed to the user. The javascript code is a little obfuscated, more to keep the size down than to obscure the contents. You can look at it here.
The script handles the onkeydown event of the search box. When that fires, it grabs the contents of the search box and sends the contents to a Google server for suggestions.
A request to the suggestion server looks like this:
In return, the suggestion server returns some results as javascript. Here are the results that get returned when I have typed "netcaptor" in the box:
Cool, huh?
Hacked appropriately, this could be a cool tool for generating related searches to a given keyword. Here’s a quick, first attempt - I put together some sample code that grabs Google’s suggestion for a given keyword (or partial). GPL’ed PHP source code is included.
Oh yeah - you might be interested in my earlier post about hacking Adsense for Feeds.
Koldark's Komputer World said,
December 10, 2004 @ 1:33 pm
Google Suggest
Google Suggest attempts to predict what you are searching for as you type in your seach. It is rather cool and may help prevent misspellings. OreillyNet talks about it as well Update: Adam Stiles hacks the code to figure out…
nerowolfe said,
December 10, 2004 @ 3:17 pm
See also Google’s AdWords keyword suggestion tool:
https://adwords.google.com/select/main?cmd=KeywordSandbox
blog.bulknews.net said,
December 10, 2004 @ 8:51 pm
Hacking Google Suggest
Adam Stiles: Hacking Google Suggest Google の新機能 Google Suggest が話題ですが、さっそく JavaScript を解析されています。JavaScript でインクリメンタル検索 とほぼ同じで、onKeyDown イベントでサーバにク…
saso badovinac said,
December 11, 2004 @ 12:16 am
it works nice
but it has make me thinking… pushing technology like this too far could bring us a less “free” search experience. to try to make you thinking in this direction i will give a more extrem exsample. lets say i would search for nana, and the search engen would say “lets search for banana, i have a lot of links for banana”
search engens could get worse because most of people would search the suggested keywords (for wich the search engen has or should had good results), but nobody would try to find some new, unexplored secrets of the web…
regards, saso
Johan Svensson said,
December 11, 2004 @ 4:27 am
It doesn’t work with meta-keywords like “site:domain.tld”. Too bad, you could use it as a search engine for your own site otherwise.
Nick Bradbury said,
December 11, 2004 @ 4:32 am
Hacking Google Suggest
Adam Stiles does some tinkering and shows how Google Suggest works.
Preoccupations said,
December 11, 2004 @ 5:23 am
Google Suggest
Adam Stiles has been probing Google Suggest:Google’s Suggest feature is lighting up the blogosphere these days. It functions as like autocomplete for your search box, where Google attempts to determine what you are searching for and gives you suggestio…
A Day After Yesterday said,
December 11, 2004 @ 8:44 am
Hacking Google Suggest
Adam Stiles: Hacking Google Suggest
Google’s Suggest feature is lighting up the blogosphere these days. It functions as like au
tokuhirom said,
December 11, 2004 @ 10:29 am
I wrote Python module.
http://tokuhirom.dnsalias.org/~tokuhirom/wiki/PyGoogleSuggest_2den
mal said,
December 11, 2004 @ 11:06 am
How long will it take to embed it into Mozilla / Firefox search plugin? Hmm… $5 to the first to do so.
Silicon Barista said,
December 11, 2004 @ 2:38 pm
Adam Stiles: Hacking Google Suggest
Very neat tool. Helps you spell out words that you are searching for. Nice little hack at the bottom of Adam’s page.
Google’s Suggest
feature is lighting up the blogosphere these days. It functions as like
autocomplete for your search box, where…
bulknews.typepad.com said,
December 11, 2004 @ 2:55 pm
Hacking Google Suggest
Link: Adam Stiles: Hacking Google Suggest. At its simplest, Google Suggest is javascript code that looks at what you are typing in the Google search box. When you press a key, GS phones home and passes the current contents of
Lea de Groot said,
December 11, 2004 @ 9:22 pm
Hmmm… just wondering if this violates Google’s terms of service re scraping? Should it use the API?
Possibly its violating the letter, but not the spirit, as its only doing a single search per query? I haven’t read them in ages.
ad Weblog said,
December 12, 2004 @ 2:12 am
Hacking Google Suggest
Adam Styles has the details on the Google Suggest code. The service is kind of a autocomplete for the search box, where Google gives you suggestions and the number of results for those. Implemented with some JavaScript, a request sends
Richard Soderberg said,
December 12, 2004 @ 6:25 am
A Firefox module that auto-completes using this would be extraordinarily cool.
VagueWare.com said,
December 12, 2004 @ 10:43 am
Hack that Suggest Box
Unless Google work out a way to monetize use of Google Suggest being played with, this kind of thing is probably going to be stopped at some point. Still, its nice that the objuscated javascript is being understood by somebody out there.
timvw said,
December 12, 2004 @ 11:52 am
a nice library that allows you to do the same stuff (using a php backend) http://jpspan.sourceforge.net
fe this demo http://jpspan.sourceforge.net/examples/autocomplete.php
Erik Benson's Morale-O-Meter said,
December 12, 2004 @ 12:20 pm
Using Google Suggest as a javascript web service
http://www.adamstiles.com/adam/2004/12/hacking_google_.html...
Gautam Guliani's home on the web said,
December 12, 2004 @ 12:41 pm
Google Suggest - Time you change my browser homepage
Joel on Software writes
Tim Haines said,
December 12, 2004 @ 3:08 pm
Google Innovation
Tim Haines said,
December 12, 2004 @ 3:08 pm
Google Innovation
Alex Barnett blog said,
December 12, 2004 @ 3:43 pm
Hacking Google Suggest
Xriso said,
December 12, 2004 @ 5:31 pm
They already have a firefox extension for this! Check it out: http://www.loconet.ca . It has some issues but not bad for a night of hacking.
Textiplication said,
December 12, 2004 @ 7:40 pm
More on Google Suggest
Google Suggest is getting a lot of attention around the web.
Journal said,
December 13, 2004 @ 1:56 am
Google Suggest
The big geeky story around the blogosphere these days is the new Google Suggest feature. Drew McLellan takes you behind…
Magic Bean Dip said,
December 13, 2004 @ 4:42 am
Google Suggest
In the gaggle of posts on the new Google Suggest Beta search tool, these are the ones I’ve found notable:
Best Quote: That’s right–Google doesn’t suggest “sex.” by Elliot Back (And here I thought Google Guy was tight-lipped)
Most U…
Mikel Maron said,
December 13, 2004 @ 8:07 am
I second the Firefox/Mozilla auto-complete search box.
cogdogblog said,
December 13, 2004 @ 8:11 pm
Dissecting the Code: Google Suggest
Found surfing RSS feeds of someone else’s del.icio.us tagged bag… If you’ve not come across the beta of Google’s new feature, take a peek at Google Suggest, which works like autocomplete by responding with common/popular search queries based on the…
line of site said,
December 13, 2004 @ 9:19 pm
obfuscation
one of the interesting things about google’s suggest service is that the javascript is obfuscated to reduce it’s size (see http://www.adamstiles.com/adam/2004/12/hacking_google_.html) and save bandwidth. this is also a great trick in general for J2ME d…
Kemayo said,
December 13, 2004 @ 9:53 pm
Google Suggest
Behind the curve, I know, but Google Suggest is quite impressive. It attempts to autocomplete whatever you’re typing — not a feat one normally associates with the web. It’s done with pure client-side JavaScript — every time you press a key it sen…
pb said,
December 13, 2004 @ 10:10 pm
I’d like to see more information about how to perform HTTP GETs from the various browsers and parse/display the results in the browser. There seems to be a distinct dearth of informationabout how to do this.
Weblog Zonder Haast said,
December 14, 2004 @ 12:46 am
Hacking Google Suggest
(Bron)
At its simplest, Google Suggest is javascript code that looks at what you are typing in the Google search box. When you press a key, GS phones home and passes the current contents of the search box.
Je kon er op wachten natuurli…
Utsikt frn en etta i Ronneby said,
December 14, 2004 @ 3:30 am
Bakom rubrikerna
Frmodligen var jag inte ensam om att undra vad ma…
Ekkie movin' on... said,
December 17, 2004 @ 5:36 am
Google suggest, handig !!
Google heeft weer iets handigs in de test staan, Google suggest. Als je nu iets invoert krijg je direct te zien heoveel resultaten dit oplevert. Goed bedacht !! Alleen jammer dat het zoeken van ekkie geen echte resultaten weergeeft…….
Craig's Manila Test Site said,
December 21, 2004 @ 11:42 pm
http://167.89.225.170/2004/12/21#a251
Oded said,
December 28, 2004 @ 10:07 am
Great Article.
BUT, Do you have an explanation for VB (ASP)?
Would be appriciate.
Thanks!
IO said,
January 18, 2005 @ 6:58 pm
Hacking Google Suggest
Adam Stiles: Hacking Google Suggest
Google’s Suggest feature is lighting up the blogosphere these days. It functions as like au
IO said,
January 18, 2005 @ 8:11 pm
Hacking Google Suggest
Adam Stiles: Hacking Google Suggest
Google’s Suggest feature is lighting up the blogosphere these days. It functions as like au
Anonymous said,
February 8, 2005 @ 10:02 pm
http://www.google.com/complete/search?hl=en
Steve said,
July 18, 2005 @ 11:01 pm
Good article. Wanted to let you know that we recently created a proof-of-concept app at ajaxed.com that allows users to add keyword autosuggest capability (similar to Google Suggest) to their website without any custom programming. We’d appreciate any feedback you can provide.
nobodyz said,
November 16, 2005 @ 6:29 am
saso badovinac said,
>
That’s what I’m saying! I immediately was intensely ANNOYED at this “google suggest” garbage. I want to search for what I want to search for — not what 40 million other people searched for.
I am not happy when someone or someplace attempts to steal my freedom to think for myself. I’m sorry that other people never learned how to spell, but that’s not MY problem. Damn! Get a dictionary and learn, folks. This “the web will think for you, spell for you, entertain you” attitude with the latest technology is going too far if you ask me. “User friendly” has overreached its grasp.
-nobodyz
Anonmoose said,
December 9, 2005 @ 8:09 pm
I like how when you type “tay” it automatically suggests Taylor Rain! Those google guys are thinking on the right level.
Jürgen said,
March 17, 2007 @ 3:52 pm
Great Post. Very helpfull informations. Thanks a lot. Jürgen from Germany.