Skip to content

Latest commit

 

History

History
52 lines (37 loc) · 1.6 KB

README.md

File metadata and controls

52 lines (37 loc) · 1.6 KB

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