1
ytdl-core
モジュール(https://github.com/fent/node-ytdl-core)を使用してYoutubeビデオオーディオをダウンロードしようとしています。Express APIとytdlでオーディオファイルをダウンロードする
私は私がそのURLでオーディオをダウンロードすることができますExpressを使用してAPIを書いた:
app.get('/api/downloadYoutubeVideo', function (req, res) {
res.set('Content-Type', 'audio/mpeg');
var videoUrl = req.query.videoUrl;
var videoName;
ytdl.getInfo(videoUrl, function(err, info){
videoName = info.title.replace('|','').toString('ascii');
res.set('Content-Disposition', 'attachment; filename=' + videoName + '.mp3');
});
var videoWritableStream = fs.createWriteStream('C:\\test' + '\\' + videoName); // some path on my computer (exists!)
var videoReadableStream = ytdl(videoUrl, { filter: 'audioonly'});
var stream = videoReadableStream.pipe(videoWritableStream);
});
問題は、私は、このAPIを呼び出すときに、私は私のサーバーから504エラーが出るということです。
ダウンロードしたオーディオをローカルディスクに保存したいと考えています。
助けていただければ幸いです。ありがとう