Skip to content

goto-bus-stop/youtube-suggest

Repository files navigation

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

About

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

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •