Clever Hacking: google.js
I am learning to love Windows. Yeh it has its own problems and sometimes could be a bit insecure but in general, it just works well and every single piece of it is reusable and scriptable. Today, I quickly wrote a Google search scraper. It runs straight from the command line.

Pay attention on the size of the script and the level of clarity of the code. Moreover, it is well integrated with the host’s setup and connection settings (proxies, socks, etc). You cannot do that even with Python. Thanks Microsoft.
http://www.gnucitizen.org/blog/clever-hacking-google_js/google.js
There are two way you can run the script. If you default scripting engine is cscript, then you can just type: google.js some query here. If this is not the case then you either need to be explicit like this: cscript /nologo google.js some query here, or make cscript default like this: cscript //H:CScript. Whatever you do, the code will run and will work flawlessly.
I enjoy when things are plain and easy or just simply clever.
Comments
When running your script I’m getting:
No output for me, when I debug, it seems like I have no tag <a> in the returned document but when I sniff, I could see answers from Google, furthermore the script sends 2 requests (q=xxx, q=xxx&start=10)
I wrote a similar script in perl to find all web servers crawled by google for a specific domain (ie: gnucitizen.org). I did not use the wap version, is there any reason to use it ? (speeder, smaller … ?)
Hi, no outpout when using no proxy. But when passing through Paros, results are returned. Maybe an issue with Accept-Encoding: gzip,deflate…
strange, it should work flawlessly… are you sure that your system proxy settings are set correctly?
Yes, it sounds like MSXML2.DOMDocument could not deflate gzip. If I disable HTTP/1.1 on Internet Explorer settings, it works better, in this case no gzip encoding support.
Nevertheless, foreach page Google returns, the DTD is checked. This represents 31 documents downloaded…
nori, cheers for that.
Working fine for me. Its lovely
same here. No output when not using any proxy
I don’t know. it works really well for me. Check if cscript is your default scripting engine. If not, just follow the steps described above.
followed all three steps man, still, it doesn’t work. Strange.