Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/goto-bus-stop/youtube-suggest
get youtube search suggestions for a query, in node.js and the browser
https://github.com/goto-bus-stop/youtube-suggest
Last synced: 27 days ago
JSON representation
get youtube search suggestions for a query, in node.js and the browser
- Host: GitHub
- URL: https://github.com/goto-bus-stop/youtube-suggest
- Owner: goto-bus-stop
- License: other
- Created: 2019-11-07T15:52:55.000Z (about 5 years ago)
- Default Branch: default
- Last Pushed: 2023-03-13T10:57:00.000Z (over 1 year ago)
- Last Synced: 2024-10-05T16:01:19.648Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 24.4 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# youtube-suggest
get youtube search suggestions for a query, in node.js and the browser
[Install](#install) - [Usage](#usage) - [License: Apache-2.0](#license)
[![npm][npm-image]][npm-url]
[![ci status][actions-image]][actions-url]
[![standard][standard-image]][standard-url][npm-image]: https://img.shields.io/npm/v/youtube-suggest.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/youtube-suggest
[actions-image]: https://github.com/goto-bus-stop/youtube-suggest/actions/workflows/ci.yml/badge.svg
[actions-url]: https://github.com/goto-bus-stop/youtube-suggest/actions/workflows/ci.yml
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: http://npm.im/standard## Install
```
npm install youtube-suggest
```## Usage
```js
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`
Do a network request for suggestions, returning the suggested completion strings as an array.Optionally specify an [ISO639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code to get
completions intended for that locale:
```js
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](LICENSE.md)