You can see the changelog here
You have to bear in mind that this does not use an official youtube api, there is no documentation and a change could cause it to throw an error, besides that there are things that I do not know, such as different privacy settings or rendering
const { getVideo, getPlaylist, search } = require('@fabricio-191/youtube')
.setDefaultOptions({
location: 'AR',
language: 'es-419'
});
here you can see a JSON that shows the information that each method gives (I do not put it here, because it is a lot)
- returns a
Promise
getVideo('https://www.youtube.com/watch?v=H2wCwdHk-ao&list=PLDS0dpumEOi0pu_0pCGqvcaRkxg-o1gqg')
.then(data => {
console.log(data);
//do something...
})
.catch(console.error);
- returns a
Promise
getPlaylist('https://www.youtube.com/watch?v=H2wCwdHk-ao&list=PLDS0dpumEOi0pu_0pCGqvcaRkxg-o1gqg')
.then(data => {
console.log(data);
//do something...
})
.catch(console.error);
- returns a
Promise
search('Node.js', { quantity: 40 })
.then(data => {
const videos = data.results.filter(x => x.type === 'video');
//do something...
})
.catch(console.error);
- returns
this
The default options are:
{
language: 'en',
location: 'US',
quantity: 'all',
requestsOptions: {}
}
The default quantity
for a search is 20
The requestsOptions
are passed directly to the http.request()
(or https) method
here you can see which can be
And here you can see a list of valid locations
and languages
When you pass options to a method, the options without value, will be taken from the default values
- In an array of Thumbnails, the first will always be the bigger
- Some structures have a
toString()
method that returns the clear text in it, for others is an URL, like in an array of thumbnails
- A method to download videos
Make typings and JSDocImprove error handling- A method to get info and videos from a channel
- Get comments from a video