Monday, December 13, 2004

Google Suggest

Just had a look at Google Suggest. It prompts you with relevant keywords, as you key-in a search query. Suggest was written by Kevin Gibbs in 20% of his working time.

All the magic happens inside ac.js which is apparently some form of "condensed" Javascript -- They might even be running it through a Javascript code-obfuscator, for all I know. Have a look at the following snippet from ac.js if you don't believe me.

function U(i){if(!i)return null;return Qa(i,"cAutoComplete")}
function wa(i){if(!i)return null;return Qa(i,"dAutoComplete")}
function F(){document.getElementById("completeDiv").style.visibility="hidden"}
function cb(){document.getElementById("completeDiv").style.visibility="visible";ba()}
function Ma(is,cs,ds){Ua[is]=new Array(cs,ds)}


Hence, the best way forward towards successfully reverse-engineering Suggest, is to use
Firefox Live HTTP Headers extension. Suggest works by going back to the Google web-servers to get the matching keywords, while you key-in your search query (must be generating a lot of load on their servers though). Uses XmlHttpRequest. Interesting!

No comments: