From a2f13c7e8f0bb8fb52abfa6a8c0df1a709c208b3 Mon Sep 17 00:00:00 2001 From: localhost Date: Fri, 1 Aug 2025 21:07:26 +0300 Subject: [PATCH] new uploading --- src/router/websocket.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/router/websocket.ts b/src/router/websocket.ts index 096c995..2ec34fa 100644 --- a/src/router/websocket.ts +++ b/src/router/websocket.ts @@ -24,8 +24,10 @@ const cleanup = async (ws: any, videoId: string) => { }; const handleUpload = async (ws: any, videoId: string, isChannel: boolean = false) => { - const filePath = `./videos/${videoId}.mp4`; - if (!fs.existsSync(filePath)) { + // the pattern of files that have finished downloading is [videoid].mp4, but some extensions are also possible due to + // current youtube changes, so we need to make sure the other extensions are also covered + const filePath = fs.readdirSync('./videos/').find(f => f.includes(`${videoId}.`)) + if (!filePath) { ws.send(`DATA - Video file for ${videoId} not found. Skipping.`); return false; }