From 6acf62ec2610df1daf14b9e2474a17ebcd84f5e1 Mon Sep 17 00:00:00 2001 From: localhost Date: Thu, 20 Nov 2025 23:12:17 +0100 Subject: [PATCH] get video quality only after confiming its downloadable, duh --- index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.ts b/index.ts index 6e45422..5fe2799 100644 --- a/index.ts +++ b/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.'); 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}).`); @@ -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;