fix
This commit is contained in:
parent
96a44e5cb2
commit
54ca4ea3d9
1 changed files with 4 additions and 1 deletions
5
index.js
5
index.js
|
@ -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)) {
|
||||
|
|
Loading…
Reference in a new issue