Skip to content

Commit 09cc670

Browse files
committed
Added example for downloading YouTube videos as mp3 files for the video How to Download YouTube Videos with Node.js using YouTube DL
1 parent dd2e83b commit 09cc670

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

  • How to Download YouTube Videos with Node.js using YouTube DL
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Import dependencies
2+
const youtubedl = require("youtube-dl");
3+
4+
// Download the YouTube audio as a mp3 - https://askubuntu.com/questions/178481/how-to-download-an-mp3-track-from-a-youtube-video
5+
youtubedl.exec("https://www.youtube.com/watch?v=-jEuLl-wuxc", ["--format", "bestaudio/best[height<=1080]","--extract-audio","--audio-format","mp3"], { cwd: __dirname },
6+
(err, output) => {
7+
8+
if (err) throw err;
9+
10+
console.log(output.join("\n"));
11+
12+
});

0 commit comments

Comments
 (0)