fix(sync): 403 InnerTube = version client inventée; aligne WEB 2.20260623.01.00 + expose ytReason
This commit is contained in:
+9
-2
@@ -506,7 +506,12 @@ async function innertubePost(path, apiKey, accessToken, body, label = 'innertube
|
||||
if (!resp.ok) {
|
||||
const err = new Error(`${label}_failed_${resp.status}`);
|
||||
err.status = resp.status === 401 ? 401 : resp.status;
|
||||
err.details = data?.error || undefined;
|
||||
// Motif YouTube (sans PII) pour diagnostiquer : ex. rateLimitExceeded,
|
||||
// botGuard, authError... remonte jusqu'à l'UI.
|
||||
try {
|
||||
const e0 = data?.error?.errors?.[0] || {};
|
||||
err.ytReason = String(e0.reason || data?.error?.message || '').slice(0, 160) || undefined;
|
||||
} catch {}
|
||||
throw err;
|
||||
}
|
||||
return data;
|
||||
@@ -522,7 +527,9 @@ async function innertubePost(path, apiKey, accessToken, body, label = 'innertube
|
||||
}
|
||||
|
||||
function innertubeContext() {
|
||||
return { client: { clientName: 'WEB', clientVersion: '2.20260101.00.00', hl: 'fr', gl: 'FR' } };
|
||||
// Version du client WEB alignée sur youtubei.js (dépendance du projet) :
|
||||
// une version inconnue/inventée est rejetée en 403 par l'anti-bot.
|
||||
return { client: { clientName: 'WEB', clientVersion: '2.20260623.01.00', hl: 'fr', gl: 'FR' } };
|
||||
}
|
||||
|
||||
/** Boucle browse + continuations générique (FEhistory, WL, ...). */
|
||||
|
||||
Reference in New Issue
Block a user