Understanding the Google API Response

While the Google API grants you programmatic access to Google’s Web index, it doesn’t provide all the functionality available through the Google.com web site’s search interface.

Can Do

The Google API, in addition to simple keyword queries, supports the following ["Special Syntaxes” in Chapter 1]:

site:
daterange:
intitle:
inurl: 
allintext:
allinlinks:
filetype:
info:
link:
related: 
cache:

Can’t Do

The Google API does not support these special syntaxes:

phonebook: 
rphonebook:
bphonebook:
stocks:

While queries of this sort provide no individual results, aggregate result data is sometimes returned and can prove rather useful. googly.php [Hack #96] , for instance, displays the number of results (estimatedTotalResultsCount).

The 10-Result Limit

While searches through the standard Google.com home page can be tuned ["Setting Preferences” in Chapter 1] to return 10, 20, 30, 50, or 100 results per page, the Google Web API limits the number to 10 per query. This doesn’t mean, mind you, that the rest are not available to you, but it takes a wee bit of creative programming entailing looping through results, 10 at a time [Hack #95] .

What’s in the Results

The Google API provides both aggregate and per-result data in its result set.

Aggregate data

The aggregate data, information on the query itself and on the kinds and number of results that query turned up, consists of:

<documentFiltering>

A Boolean (true/false) value specifying whether or not results were filtered ...

Get Google Hacks, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.