Node.js library for downloading songs from Youtube in webm, mp3, wav, opus, ogg formats
npm install yt-audio-dlp
Make sure you're installing the latest version of yt-auido-dlp to keep up with the latest fixes.
import YoutubeAudio from "yt-audio-dlp";
const youtubeAudio = new YoutubeAudio();
(async function () {
try {
const { audio, buffer, headers, options } =
await youtubeaudio.getAudioById(/ VideoId /, {
outputFormat: "mp3",
});
} catch (error) {
console.error(error);
}
})();
import YoutubeAudio from "yt-audio-dlp";
const youtubeAudio = new YoutubeAudio();
const { audio, buffer, headers, options } = await youtubeaudio.getAudioById(
/ VideoId /,
{
outputFormat: "webm",
socks: "socks5://127.0.0.1:9050",
proxy: {
host: / host /,
port: / port /
auth: {
username: / if required /,
password: / if required /
}
}
}
);
npm i -g yt-audio-dlp
yt-audio-dlp -u "https://www.youtube.com/watch?v=MfFbdLXAL9U" -f mp3
This package requires installation ffmpeg -> https://www.ffmpeg.org/