README
@hrtube/ytpl
Simple js only module to resolve YouTube playlist ids Doesn't need any login or GoogleAPI key
Usage
var ytpl = require('@hrtube/ytpl');
ytpl('UU_aEa8K-EOJ3D6gOs7HcyNg').then(playlist => {
dosth(playlist);
}).catch(err => {
console.error(err);
});
API
ytpl(id, [options])
Attempts to resolve the given playlist id
id
- id of the yt-playlist
- or playlist link
- or user link (resolves uploaded playlist)
- or channel link (resolves uploaded playlist)
options
- object with options
- possible settings:
- limit[Number] -> limits the pulled items, defaults to 100, set to Infinity to get the whole playlist - numbers <1 result in the default being used
- All additional parameters will get passed to miniget, which is used to do the https requests
returns a Promise
ytpl.validateID(string)
Returns true if able to parse out a (formally) valid playlist ID.
ytpl.getPlaylistID(string)
Returns a playlist ID from a YouTube URL. Can be called with the playlist ID directly, in which case it resolves.
Returns a promise.
Install
npm install @hrtube/ytpl
License
MIT