get video quality only after confiming its downloadable, duh

This commit is contained in:
localhost 2025-11-20 23:12:17 +01:00
parent a5ba61e066
commit 6acf62ec26
1 changed files with 3 additions and 3 deletions

View File

@ -132,9 +132,6 @@ app.ws('/download/:id', async (ws, req) => {
return ws.close()
}
if (parseInt(info.videoDetails.lengthSeconds) >= 900) quality = '360p' // 15min
quality = getVideoQuality(info, quality)
if (info.playabilityStatus?.status !== 'OK') {
ws.send(`This video is not available for download (${info.playability_status?.status} ${info.playability_status?.reason}).`);
return ws.close()
@ -146,6 +143,9 @@ app.ws('/download/:id', async (ws, req) => {
return ws.close()
}
if (parseInt(info.videoDetails.lengthSeconds) >= 900) quality = '360p' // 15min
quality = getVideoQuality(info, quality)
let audioOutputStream: DownloadOutput | undefined;
let videoOutputStream: DownloadOutput | undefined;