This commit is contained in:
The Ghost of FOSS' Past 2024-10-28 11:22:43 -05:00
parent 96a44e5cb2
commit 54ca4ea3d9

View file

@ -64,12 +64,15 @@ app.get('/download', (req, res) => {
return res.status(500).json({ error: 'An error occurred while downloading the video.', details: stderr });
}
// Parse the output to get the file name
const filename = stdout.split('\n').find(line => line.includes('Destination'))?.split(' ')[1];
if (!filename) {
return res.status(500).json({ error: 'Downloaded file not found.' });
}
// Full path of the downloaded file
const downloadedFilePath = outputPath;
const downloadedFilePath = outputPath
// Check if the file exists and send it
if (fs.existsSync(downloadedFilePath)) {