New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

suggestion

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

suggestion

Google suggest API

2.1.2
latest
Source
npm
Version published
Weekly downloads
218
-35.31%
Maintainers
2
Weekly downloads
 
Created
Source

suggestion

Queries google's suggestions API

build status

Installation

This module is installed via npm:

$ npm install suggestion

Example Usage

Hit up google suggest with a single query

var suggest = require('suggestion');
suggest('dog training', function (err, suggestions) {
  if (err) throw err;
  console.log(suggestions);
  /*
  [ 'dog training',
    'dog training tips',
    'dog training collars',
    'dog training classes',
    'dog training videos',
    'dog training houston',
    'dog training certification',
    'dog training books',
    'dog training chicago',
    'dog training clicker' ]
  */
})

Iterate through another level of google suggest

You can get even more suggestions by appending ' a', ' b', ' c' to your google suggest query. This does it down to one level from a to z.

NB: currently only one level of traversal is supported. Pull requests welcome.

var suggest = require('suggestion');
suggest('dog training', { levels: 1 }, function (err, suggestions) {
  if (err) throw err;
  console.log(suggestions);
  /*
  [ 'dog training atlanta',
    'dog training austin',
    'dog training app',
    'dog training albuquerque',
    'dog training at home',
    'dog training albany ny',
    'dog training aids',
    'dog training and boarding',
    'dog training ann arbor',
    'dog training academy',
    'dog training books',
    .... (260 total results) ...
    'dog training zapper',
    'dog training zone',
    'dog training zoom room',
    'dog training zimmerman mn',
    'dog training zachary la',
    'dog training zak',
    'dog training zionsville',
    'dog training zebulon nc',
    'dog training zionsville indiana' ]
  */
});

Youtube Suggest

Pass in "youtube" as the client option:

var suggest = require('suggestion');
suggest('dog training', { client: 'youtube' }, function (err, suggestions) {
  if (err) throw err;
  console.log(suggestions);
  /*
  [ 'dog training',
    'dog training collars',
    'dog training tips',
    'dog training near me',
    'dog training classes',
    'dog training videos',
    'dog training books',
    'dog training schools',
    'dog training clicker',
    'dog training houston' ]*/
});

Change language

Pass in the language code as the hl option:

var suggest = require('suggestion');
suggest('包', { hl: 'zh-CN' }, function (err, suggestions) {
  if (err) throw err;
  console.log(suggestions);
  /*
  [ '包贝尔', '包子', '包子馅',
    '包青天', '包菜', '包包', '包', '包容',
    '包法利夫人', '包租婆' ]
  */
});

Keywords

google

FAQs

Package last updated on 20 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts