From 6e820581f1166dd8225fec10ce7cbbf8c44b54d1 Mon Sep 17 00:00:00 2001 From: localhost Date: Sun, 22 Feb 2026 20:17:04 +0100 Subject: [PATCH] add catching for already deleted videos --- index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.ts b/index.ts index 4f5c6e1..2e1a21c 100644 --- a/index.ts +++ b/index.ts @@ -126,6 +126,11 @@ app.ws('/download/:id', async (ws, req) => { let quality = '480p' const info = await getInfo(req.params.id); + if (info.playabilityStatus?.errorScreen?.playerErrorMessageRenderer?.subreason?.simpleText) { + ws.send(`This video is not available for download (${info.playabilityStatus.errorScreen.playerErrorMessageRenderer.subreason.simpleText}).`); + return ws.close() + } + if (!info || info.videoDetails.lengthSeconds == undefined) { ws.send('Unable to retrieve video info from YouTube. Please try again later.'); return ws.close()