youtube-suggest
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

youtube-suggest

get youtube search suggestions for a query, in node.js and the browser

Install - Usage - License: Apache-2.0

npm ci status standard

Install

npm install youtube-suggest

Usage

var youtubeSuggest = require('youtube-suggest')
var assert = require('assert')

youtubeSuggest('query').then(function (results) {
  assert(Array.isArray(results))
  assert(typeof results[0] === 'string')
})

API

youtubeSuggest(query: string, opts?: { locale?: string }): Promise<string[]>

Do a network request for suggestions, returning the suggested completion strings as an array.

Optionally specify an ISO639-1 language code to get completions intended for that locale:

youtubeSuggest('pet', { locale: 'en' }) // returns people named "peter", pet video titles, etc
youtubeSuggest('pet', { locale: 'fr' }) // returns various small things

In Node.js it uses node-fetch. In the browser it uses JSONP.

License

Apache-2.0

Package Sidebar

Install

npm i youtube-suggest

Weekly Downloads

18

Version

1.2.0

License

Apache-2.0

Unpacked Size

10.3 kB

Total Files

11

Last publish

Collaborators

  • goto-bus-stop