Presentation is loading. Please wait.

Presentation is loading. Please wait.

Google Web API See: Concept: With the Google Web APIs service, software developers can query more than 3 billion web documents.

Similar presentations


Presentation on theme: "Google Web API See: Concept: With the Google Web APIs service, software developers can query more than 3 billion web documents."— Presentation transcript:

1 Google Web API See: http://www.google.com/apis/

2 Concept: With the Google Web APIs service, software developers can query more than 3 billion web documents directly from their own computer programs. Google uses the SOAP and WSDL standards so a developer can program in his or her favorite environment - such as Java, Perl, or Visual Studio.NET.

3 Google Web APIs provide three service: Search relative web pages according to the keyword(s) user supplies Return the cached web page to the user by the URL user supplies Correct the spell of the word user inputs

4 Search Requests: Search requests submit a query string and a set of parameters to the Google Web APIs service and receive in return a set of search results. Search results are derived from Google’s index of over 2 billion Web pages.

5 Seach Request Format: NameDescription KeyProvided by Google, Google uses the key for authentication and logging QQuery string startZero-based index of the first desired result maxRes ults Number of results desired per query. The maximum value per query is 10. (see next page)

6 filterActivates or deactivates automatic results filtering, which hides very similar results and results that all come from the same Web host. restrictRestricts the search to a subset of the Google Web index, such as a topic like “Linux”. safeSe arch A Boolean value which enables filtering of adult content in the search results. lrLanguage Restrict-Restricts the search to documents within one or more languages.

7 Search Results Format: Search Response----Each time you issue a search request to the Google service, a response is returned to you. (We will describe the meanings of the values returned to you.) Result Element

8 Search Response: --A Boolean value indicating whether filtering was performed on the search results --A text string intended for displaying to an end user --The estimated total number of results that exist for the query

9 Continue: --A Boolean value indicating that the estimate value is actually the exact value --An array of items. This corresponds to the actual list of search results --This is the value of for the search request

10 Continue: --Indicates the index (1-based) of the first search result in --Indicates the index(1-based) of the last search result in --A text string intended for displaying to the end user. It provides instructive suggestions on how to use Google

11 Continue: --An array of items --Text, floating-point number indicating the total server time to return the search results, measured in seconds

12 Cache Requests: Cache requests submit a URL to the Google Web APIs service and receive in return the contents of the URL when Google’s crawlers last visited the page.

13 Spelling Requests: Spelling requests submit a query to the Google Web APIs service and receive in return a suggested spell correction for the query (if available).

14 Java Implementation: Google provides a java implementation of the Google Web APIs We will take a look at it and provide an example finally.

15 The java classes: com.google.soap.search.GoogleSearch com.google.soap.search.GoogleSearchRe sult com.google.soap.search.GoogleSearchRe sultElement com.google.soap.search.GoogleSearchFa ult com.google.soap.search.GoogleSearchDir ectoryCategory

16 Usage Demo: GoogleSearch s = new GoogleSearch(); s.setKey(clientKey); try { if (directive.equalsIgnoreCase("search")) { s.setQueryString(directiveArg); GoogleSearchResult r = s.doSearch(); System.out.println(r.toString()); } else if (directive.equalsIgnoreCase("cached")) { byte [] cachedBytes = s.doGetCachedPage(directiveArg); String cachedString = new String(cachedBytes); System.out.println(cachedString); } else if (directive.equalsIgnoreCase("spell")) { System.out.println("Spelling suggestion:"); String suggestion = s.doSpellingSuggestion(directiveArg); System.out.println(suggestion); }

17 Example program: You can download the executive files and source files of the example from Dr. Wang’s home page.


Download ppt "Google Web API See: Concept: With the Google Web APIs service, software developers can query more than 3 billion web documents."

Similar presentations


Ads by Google