Following on from my last post, I just had a quick look at the data being transferred by Google’s AJAX search API. It’s really simple:

That returns a JavaScript expression of the form:

f('0', {results:[...]}, 200, null, 200)

To parse the results, just throw the second parameter of the function through a JSON parser.

Unfortunately, the Ruby JSON parser doesn’t like the non-string hash keys (result and so on) but it wouldn’t be a huge effort to fix that.

Update: I’ve written a basic Ruby library. There are more details in the comments.