11 lines
331 B
JavaScript
11 lines
331 B
JavaScript
const fs = require('fs'),
|
|
url = process.argv[2],
|
|
ytdl = require('ytdl-core'),
|
|
ffmpeg = require('fluent-ffmpeg'),
|
|
stream = new ffmpeg(ytdl(url, { filter: 'audioonly' }))
|
|
|
|
stream.on('error', function (err) {
|
|
console.log(err)
|
|
})
|
|
.format('mp3').pipe(fs.createWriteStream(__dirname + '/' + url.replace(/^.*v=/, '') + '.mp3'))
|