debug(sync): endpoint diag multi-endpoints (Data API + InnerTube) + bouton UI
This commit is contained in:
@@ -717,6 +717,50 @@ function textOf(t) {
|
||||
return String(t?.simpleText || '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Diagnostic InnerTube authentifié : teste plusieurs endpoints et rapporte
|
||||
* pour chacun ok/count ou le motif YouTube. But : isoler un rejet global
|
||||
* du compte d'un problème spécifique à l'historique.
|
||||
*/
|
||||
export async function diagnoseInnertube(conn) {
|
||||
const out = {};
|
||||
let innertube = null;
|
||||
try {
|
||||
innertube = await getAuthedInnertube(conn);
|
||||
out.session = { ok: true };
|
||||
} catch (e) {
|
||||
out.session = { ok: false, reason: String(e?.message || e).slice(0, 200) };
|
||||
return out;
|
||||
}
|
||||
const probe = async (name, fn) => {
|
||||
try {
|
||||
const r = await fn();
|
||||
out[name] = { ok: true, ...r };
|
||||
} catch (e) {
|
||||
out[name] = { ok: false, reason: libErrorDetail(e) };
|
||||
}
|
||||
};
|
||||
await probe('subscriptionsFeed', async () => {
|
||||
const feed = await innertube.getSubscriptionsFeed();
|
||||
return { count: Array.isArray(feed?.contents) ? feed.contents.length : 0 };
|
||||
});
|
||||
await probe('library', async () => {
|
||||
await innertube.getLibrary();
|
||||
return {};
|
||||
});
|
||||
await probe('accountMenu', async () => {
|
||||
const data = await innertube.session.actions.execute('/account/account_menu', {});
|
||||
const blob = JSON.stringify(data?.data || data || '').slice(0, 200);
|
||||
return { sample: blob.slice(0, 120) };
|
||||
});
|
||||
await probe('history', async () => {
|
||||
const feed = await innertube.getHistory();
|
||||
const n = Array.isArray(feed?.sections) ? feed.sections.reduce((a, s) => a + (s?.contents?.length || 0), 0) : 0;
|
||||
return { count: n };
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Chaînes YouTube du compte (sélecteur façon SmartTube) via account_menu.
|
||||
* La chaîne par défaut peut être une coquille vide (relatedPlaylists sans
|
||||
|
||||
Reference in New Issue
Block a user