From ee59ba82475cf9abc55eb42985ab692991190271 Mon Sep 17 00:00:00 2001 From: devsavsis Date: Sun, 30 Aug 2026 18:29:15 +0500 Subject: [PATCH] fix: sign-in detection case-insensitive, auto retry with Chrome cookies --- bm.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bm.js b/bm.js index 060797b..074469f 100644 --- a/bm.js +++ b/bm.js @@ -245,16 +245,20 @@ function doDownload(url, fmtIdx, retry403 = false) { dlProc.stdout.on('data', onData) dlProc.stderr.on('data', d => { const line = d.toString() + const lineL = line.toLowerCase() if (parseProgress(line)) { render(); return } - if (line.includes('ERROR') || line.includes('error')) { - lastErr = line.replace(/\x1b\[[0-9;]*m/g, '').trim().slice(0, 80) + if (lineL.includes('error') || lineL.includes('warning')) { + lastErr = line.replace(/\x1b\[[0-9;]*m/g, '').trim().slice(0, 90) st.msg = lastErr render() } - if (!got403 && (line.includes('HTTP Error 403') || line.includes('Sign in'))) { + const needsCookies = lineL.includes('403') || lineL.includes('sign in') || + lineL.includes('please sign') || lineL.includes('cookies-from-browser') || + lineL.includes('login required') || lineL.includes('not available') + if (!got403 && needsCookies && !retry403) { got403 = true dlProc.kill() - st.msg = '403 — retry с куками Chrome...' + st.msg = 'нужны куки Chrome — retry...' render() doDownload(url, fmtIdx, true) }