1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-09-20 17:11:57 +00:00
musix-oss/node_modules/simple-youtube-api/examples/playlist.js

14 lines
550 B
JavaScript

const YouTube = require('simple-youtube-api');
const youtube = new YouTube(' Y o u r A p i K e y ');
youtube.getPlaylist('https://www.youtube.com/playlist?list=PL2BN1Zd8U_MsyMeK8r9Vdv1lnQGtoJaSa')
.then(playlist => {
console.log(`The playlist's title is ${playlist.title}`);
playlist.getVideos()
.then(videos => {
console.log(`This playlist has ${videos.length === 50 ? '50+' : videos.length} videos.`);
})
.catch(console.log);
})
.catch(console.log);