node-ytsr
Simple js only module to search YouTube
Doesn't need any login or GoogleAPI key
Usage
const ytsr = require('ytsr');
let filter;
ytsr.getFilters('github', function(err, filters) {
if(err) throw err;
filter = filters.get('Type').find(o => o.name === 'Video');
ytsr.getFilters(filter.ref, function(err, filters) {
if(err) throw err;
filter = filters.get('Duration').find(o => o.name.startsWith('Short'));
var options = {
limit: 5,
nextpageRef: filter.ref,
}
ytsr(null, options, function(err, searchResults) {
if(err) throw err;
dosth(searchResults);
});
});
});
API
ytsr(searchString, [options, callback])
Searches for the given string
Pulls avaible filters for the given string/ref
Related / Works well with
Install
npm install --save ytsr
License
MIT