fent/node-ytdl-core
The issue has been closed
Copyrighted Material (Music Videos) throws an Error #510
NeuronButter posted onGitHub
Now firstly, I am aware of the restriction on YouTube's end, but that's not my problem. My problem is that when it throws the error, the process terminates. Here's my code:
app.get('/mp4', (req,res) => {
var url = req.query.url;
res.header('Content-Disposition', 'attachment; filename="video.mp4"');
ytdl(url, {
format: 'mp4'
}).pipe(res)
});
Because this is running in an Express server, everything works fine, and will work as normal when the video is successful. The problem is, when it's not, rather than logging an error, it will instead stop the Express server (the instance inside the command prompt). How do I make Express not crash Node, but instead change the response (like instead return a TXT file)?