get video quality only after confiming its downloadable, duh
This commit is contained in:
parent
a5ba61e066
commit
6acf62ec26
6
index.ts
6
index.ts
|
|
@ -131,9 +131,6 @@ app.ws('/download/:id', async (ws, req) => {
|
||||||
ws.send('Unable to retrieve video info from YouTube. Please try again later.');
|
ws.send('Unable to retrieve video info from YouTube. Please try again later.');
|
||||||
return ws.close()
|
return ws.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parseInt(info.videoDetails.lengthSeconds) >= 900) quality = '360p' // 15min
|
|
||||||
quality = getVideoQuality(info, quality)
|
|
||||||
|
|
||||||
if (info.playabilityStatus?.status !== 'OK') {
|
if (info.playabilityStatus?.status !== 'OK') {
|
||||||
ws.send(`This video is not available for download (${info.playability_status?.status} ${info.playability_status?.reason}).`);
|
ws.send(`This video is not available for download (${info.playability_status?.status} ${info.playability_status?.reason}).`);
|
||||||
|
|
@ -146,6 +143,9 @@ app.ws('/download/:id', async (ws, req) => {
|
||||||
return ws.close()
|
return ws.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parseInt(info.videoDetails.lengthSeconds) >= 900) quality = '360p' // 15min
|
||||||
|
quality = getVideoQuality(info, quality)
|
||||||
|
|
||||||
let audioOutputStream: DownloadOutput | undefined;
|
let audioOutputStream: DownloadOutput | undefined;
|
||||||
let videoOutputStream: DownloadOutput | undefined;
|
let videoOutputStream: DownloadOutput | undefined;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue