Coffeekraken.io 0.0.1

SGoogleSearch

This class let you make with ease search requests to the google custom search service with useful features like:

  • Simple pagination system
  • Promise support

Example

    // create a google search instance
const googleSearch = new SGoogleSearch('myApiKey', 'myCustomSearchContextKey');

// make a search...
googleSearch.search('hello world').then((response) => {
        // do something with the google response...
});

// get the nexts results
googleSearch.next().then((response) => {
        // do something with the new response...
});

See more : https://developers.google.com/custom-search/

Author : Olivier Bosselolivier.bossel@gmail.com

Constructor

Name Type Description Status Default
apiKey { String } The google api key to reach the services required
cx { String } The google custom search context required

Settings

Here's the list of available settings.

num

How many results by page wanted Can be between 1 and 10

Type : { Integer }

Default : 10

page

The page to request

Type : { Integer }

Default : 1

Methods

Launch a search

Name Type Description Status Default
keywords { String } The keywords to search required
settings { Object } The settings object required

Return { Promise } A promise of results

next

Load the next page

Return { Promise } The promise of next page results