ytf-downloader
v1.0.0
Published
YouTube video downloader and search API
Maintainers
Readme
YTF Downloader
A powerful Node.js package for downloading YouTube videos as MP3/MP4, searching YouTube, getting video transcripts, and more.
Installation
npm install ytf-downloaderFeatures
- Download YouTube videos as MP3 audio files
- Download YouTube videos as MP4 video files
- Search YouTube for videos
- Get video transcripts
- Get channel information
- Support for multiple quality options
Usage
Import the package
const ytf = require('ytf-downloader');Download YouTube video as MP3
// Default quality is 128kbps. Available options: 92, 128, 256, 320
ytf.ytmp3('https://www.youtube.com/watch?v=dQw4w9WgXcQ', 128)
.then(result => {
console.log(result);
// Access download URL via: result.download.url
})
.catch(error => {
console.error('Error:', error);
});Download YouTube video as MP4
// Default quality is 360p. Available options: 144, 360, 480, 720, 1080
ytf.ytmp4('https://www.youtube.com/watch?v=dQw4w9WgXcQ', 360)
.then(result => {
console.log(result);
// Access download URL via: result.download.url
})
.catch(error => {
console.error('Error:', error);
});Search YouTube
ytf.search('query terms here')
.then(result => {
console.log(result.results); // Array of search results
})
.catch(error => {
console.error('Error:', error);
});Get Video Transcript
ytf.transcript('https://www.youtube.com/watch?v=dQw4w9WgXcQ')
.then(result => {
console.log(result.transcript);
})
.catch(error => {
console.error('Error:', error);
});Extended Download Info (V2)
ytf.ytdlv2('https://www.youtube.com/watch?v=dQw4w9WgXcQ', 360)
.then(result => {
console.log(result);
// Access download URLs via: result.downloads.audio and result.downloads.video
})
.catch(error => {
console.error('Error:', error);
});Get Channel Information
ytf.channel('UCxxx') // YouTube channel ID
.then(result => {
console.log(result);
})
.catch(error => {
console.error('Error:', error);
});Response Structure
ytmp3 Response
{
status: true,
creator: "ST | Sheikh Tamim",
metadata: {
// Video metadata information from yt-search
},
download: {
status: true,
quality: "128kbps",
availableQuality: ["92", "128", "256", "320"],
url: "https://download-url.com/file.mp3",
filename: "Video Title (128kbps).mp3"
}
}ytmp4 Response
{
status: true,
creator: "ST | Sheikh Tamim",
metadata: {
// Video metadata information from yt-search
},
download: {
status: true,
quality: "360p",
availableQuality: ["144", "360", "480", "720", "1080"],
url: "https://download-url.com/file.mp4",
filename: "Video Title (360p).mp4"
}
}License
MIT
