google-suggest.js
v0.0.2-d
Published
Get Google Search suggestions from their API/datafeed.
Downloads
1
Maintainers
Readme
This module promises an array with search suggestions from Google.
GoogleSuggest will automatically cache results to ./web/query.locale.json so that we do not piss off Google. GoogleSuggest utilizes EcmaScript6 features and I have properly commented it for those who want to learn.
Syntax
GoogleSuggest(query, locale)
Arguments
- required (string) query: where to buy
- required (string) locale: en
Use
/* Search suggesstions for 'where can I' in English */
let GoogleSuggest = require('google-suggest.js')
GoogleSuggest('where can I', 'en').then(suggestions => {
console.log(suggestions)
}).catch(fail => {
console.log(fail) // fail contains error message
})
The result
The resolved array looks like this.
[
'where can i buy stamps',
'where can i get a money order',
'where can i buy dry ice',
'where can i listen to lemonade',
'where can i cash a check',
'where can i buy borax',
'where can i watch lemonade',
'where can i cash a personal check',
'where can i get a passport',
'where can i watch the olympics'
]
Related
You can find a PHP implementation using identical syntax here: https://github.com/jochemstoel/google-search-suggestions
Jochem Stoel
Involuntary public figure.