A simple YouTube video downloader for audio and video formats.
You can install the package using npm:
npm install youtube_scraper
const { search, ytmp3, ytmp4 } = require('youtube_scraper');
const url = 'https://www.youtube.com/watch?v=YOUR_VIDEO_ID';
ytmp3(url)
.then(result => {
if (result.status) {
console.log('Download Link:', result.download);
console.log('Metadata:', result.metadata);
} else {
console.error('Error:', result.result);
}
});
const url = 'https://www.youtube.com/watch?v=YOUR_VIDEO_ID';
ytmp4(url)
.then(result => {
if (result.status) {
console.log('Download Link:', result.download);
console.log('Metadata:', result.metadata);
} else {
console.error('Error:', result.result);
}
});
const query = 'your search term';
search(query)
.then(result => {
if (result.status) {
console.log('Search Results:', result.results);
} else {
console.error('Error:', result.result);
}
});