youtube-suggest
v1.2.0
Published
get youtube search suggestions for a query, in node.js and the browser
Downloads
205
Maintainers
Readme
youtube-suggest
get youtube search suggestions for a query, in node.js and the browser
Install - Usage - License: Apache-2.0
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.