Home

Awesome

DEPRECATED <node-ytsr>

This repo is no longer supported, please consider using the official api instead.

node-ytsr

NPM version NPM downloads codecov Known Vulnerabilities Discord

Simple js only package to search for Youtube for Videos, Playlists and many more. Does not require any login or Google-API-Key.

Support

You can contact us for support on our chat server

Usage

const ytsr = require('ytsr');

const searchResults = await ytsr('github');

API

ytsr(searchString, [options])

Searches for the given string

ytsr.getFilters(searchString, options)

Pulls avaible filters for the given string or link

Usage

const ytsr = require('ytsr');

const filters1 = await ytsr.getFilters('github');
const filter1 = filters1.get('Type').get('Video');
const filters2 = await ytsr.getFilters(filter1.url);
const filter2 = filters2.get('Features').get('Live');
const options = {
  pages: 2,
}
const searchResults = await ytsr(filter2.url, options);

ytsr.continueReq(continuationData)

Continues a previous request by pulling yet another page.
The previous request had to be done using pages limitation.

Usage

const ytsr = require('ytsr');

const firstResultBatch = await ytsr('github', { pages: 1 });
const secondResultBatch = ytsr.continueReq(firstResultBatch.continuation);
const thirdResultBatch = ytsr.continueReq(secondResultBatch.continuation);

// You can now use the .items property of all result batches e.g.:
console.log(firstResultBatch.items);
console.log(secondResultBatch.items);
console.log(thirdResultBatch.items);

Related / Works well with

Install

npm install --save ytsr

License

MIT