google-autocomplete

0.0.1 • Public • Published

google-autocomplete

Lightweight module that lets you easily fetch google's autocomplete suggestions for a given seed term.

Getting Started

Do this:

auto = require('autocomplete');
auto.getQuerySuggestions('house', function(err, suggestions) {
    console.log(suggestions);
})

To get this:

[
    { suggestion: 'house of cards', relevance: 750, type: 'QUERY' },
    { suggestion: 'house of prime rib', relevance: 600, type: 'QUERY' },
    { suggestion: 'house of cards season 3', relevance: 566, type: 'QUERY' },
    { suggestion: 'house of cards season 2', relevance: 565, type: 'QUERY' }
]

Reference

  1. autocomplete.getQuerySuggestions(query, callback) fetches all QUERY type results (other types of results include NAVIGATION, IMAGE, and more). Expects a standard callback function to provide (err, result) arguments to.

  2. autocomplete.getAllSuggestions(query, callback) fetches all types of suggestion types (result set will include things like places and images, see above). Expects a standard callback function to provide (err, result) arguments to.

Both methods return an array of objects which include a relevance score based on Google Search's judgment. See the above sample for example.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.1
    25
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.1
    25

Package Sidebar

Install

npm i google-autocomplete

Weekly Downloads

25

Version

0.0.1

License

none

Last publish

Collaborators

  • capablemonkey