Google Hacks Free Open Book

Google Hacks

Previous Section Next Section

5.8 Understanding the Google API Response

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

5.8.1 Can Do

The Google API, in addition to simple keyword queries, supports the following special syntaxes [Section 1.5]:

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

5.8.2 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. kincount.cgi [Hack #70], one of the hacks in this book, takes advantage of result counts returned for phonebook: queries.

5.8.3 The 10-Result Limit

While searches through the standard Google.com home page can be tuned [Hack #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 #1].

5.8.4 What's in the Results

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

5.8.4.1 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 for very similar results or those that come from the same web host

<directoryCategories>

A list of directory categories, if any, associated with the query

5.8.4.2 Individual search result data

The "guts" of a search result—the URLs, page titles, and snippets—are returned in a <resultElements> list. Each result consists of the following elements:

<summary>

The Google Directory summary, if available

<URL>

The search result's URL; consistently starts with http://

<snippet>

A brief excerpt of the page with query terms highlighted in bold (HTML <b> </b> tags)

<title>

The page title in HTML

<cachedSize>

The size in kilobytes (K) of the Google-cached version of the page, if available

You'll notice the conspicuous absence of PageRank [Hack #95]. Google does not make PageRank available through anything but the official Google Toolbar [Hack #24]. You can get a general idea of a page's popularity by looking over the "popularity bars" in the Google Directory.

    Previous Section Next Section


         Main Menu
    Main Page
    Table of content
    Copyright
    Dedication
    Credits
    Foreword
    Preface
    Chapter 1. Searching Google
    Chapter 2. Google Special Services and Collections
    Chapter 3. Third-Party Google Services
    Chapter 4. Non-API Google Applications
    Chapter 5. Introducing the Google Web API
    5.1 Hacks #50-59
    5.2 Why an API?
    5.3 Signing Up and Google's Terms
    5.4 The Google Web APIs Developer's Kit
    5.5 Using the Key in a Hack
    5.6 What's WSDL?
    5.7 Understanding the Google API Query
    5.8 Understanding the Google API Response
    Hack 50 Programming the Google Web API with Perl
    Hack 51 Looping Around the 10-Result Limit
    Hack 52 The SOAP::Lite Perl Module
    Hack 53 Plain Old XML, a SOAP::Lite Alternative
    Hack 54 NoXML, Another SOAP::Lite Alternative
    Hack 55 Programming the Google Web API with PHP
    Hack 56 Programming the Google Web API with Java
    Hack 57 Programming the Google Web API with Python
    Hack 58 Programming the Google Web API with C# and .NET
    Hack 59 Programming the Google Web API with VB.NET
    Chapter 6. Google Web API Applications
    Chapter 7. Google Pranks and Games
    Chapter 8. The Webmaster Side of Google
    Colophon
    Index


    More Books
    PHP Hacks
    Processing Xml With Java - A Guide To Sax, Dom, Jdom, Jaxp, And Trax
    The Koran (Holy Qur'an)
    Macromedia Flash 8 Bible
    Search Engine Optimization for Dummies
    YouTube Traffic
    PHP 5 for Dummies
    Harry Potter and The Chamber of Secrets
    Harry Potter and the Sorcerer's Stone
    The Pilgrim's Progress
    Wireless Hacks
    Flash Hacks. 100 Industrial-Strength Tips & Tools
    PayPal Hacks. 100 Industrial-Strength Tips and Tools
    Amazon Hacks
    Pdf Hacks
    The Da Vinci Code
    Google Hacks
    The Holy Bible
    Windows XP For Dummies
    Harry Potter and the Half-Blood Prince
    Seo Book
    Upgrading and Repairing Networks
    Macromedia Dreamweaver 8 UNLEASHED
    Windows XP Annoyances
    Windows XP Hacks
    Microsoft Windows XP Power Toolkit
    Teach Yourself MS Office In 24Hours
    iPod & iTunes Missing Manual
    PC Hacks 100 Industrial-Strength Tips and Tools
    PC Overclocking, Optimization, and Tuning - 2th Edition
    PC Hardware In A Nutshell 3rd Edition
    PC Hardware in a Nutshell, 2nd Edition
    Upgrading and Repairing PCs
    Google for Dummies
    MySQL Cookbook
    Teach Yourself Macromedia Flash 8 In 24 Hours
    PHP CookBook
    Sams Teach Yourself JavaScript in 24 Hours
    PHP5 Manual
    Free Games Paper Airplanes
    500 Juegos Gratis 500 Giochi Gratis 500 Jeux Gratuits 500 Jogos Gratis 500 Kostenlose Spiele