Show how many Viaplay accounts were tried on VOD soft-fail.
This commit is contained in:
parent
1847f3c72f
commit
89c88abc31
2 changed files with 22 additions and 3 deletions
|
|
@ -106,7 +106,7 @@ async function main() {
|
||||||
return {
|
return {
|
||||||
status: "ok",
|
status: "ok",
|
||||||
service: "master-api",
|
service: "master-api",
|
||||||
version: "1.0.4-dontgo-detect-v7",
|
version: "1.0.5-vod-rr-diag",
|
||||||
lastVodPlay: getLastVodPlay(),
|
lastVodPlay: getLastVodPlay(),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,10 @@ export type LastVodPlayDiag = {
|
||||||
mediaPath: string | null;
|
mediaPath: string | null;
|
||||||
error: string | null;
|
error: string | null;
|
||||||
resolver: string;
|
resolver: string;
|
||||||
|
/** Hoeveel accounts deze play heeft geprobeerd (eigen cookies per account). */
|
||||||
|
triedAccounts?: number;
|
||||||
|
/** Korte labels van geprobeerde accounts (geen secrets). */
|
||||||
|
triedLabels?: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
let lastVodPlay: LastVodPlayDiag | null = null;
|
let lastVodPlay: LastVodPlayDiag | null = null;
|
||||||
|
|
@ -340,8 +344,11 @@ export async function resolveViaplayGuidPlay(
|
||||||
|
|
||||||
let cachedKeys = await keysForMediaGuid(sessionSecret, guid);
|
let cachedKeys = await keysForMediaGuid(sessionSecret, guid);
|
||||||
let lastError: Error | null = null;
|
let lastError: Error | null = null;
|
||||||
|
const triedLabels: string[] = [];
|
||||||
|
const attemptErrors: string[] = [];
|
||||||
|
|
||||||
// Zelfde round-robin als live: elke VOD-play start op een ander account.
|
// Zelfde round-robin als live: elke VOD-play start op een ander account.
|
||||||
|
// Per account: eigen session/AT/PL-cookies (na persistentLogin-refresh).
|
||||||
const ordered = accountOrder(guid, accounts, []);
|
const ordered = accountOrder(guid, accounts, []);
|
||||||
|
|
||||||
const productUrl =
|
const productUrl =
|
||||||
|
|
@ -349,6 +356,8 @@ export async function resolveViaplayGuidPlay(
|
||||||
`https://content.viaplay.com/${tweaks.deviceKey}/sport/${guid}?partial=true`;
|
`https://content.viaplay.com/${tweaks.deviceKey}/sport/${guid}?partial=true`;
|
||||||
|
|
||||||
for (const account of ordered) {
|
for (const account of ordered) {
|
||||||
|
const label = account.label || account.email || account.id;
|
||||||
|
triedLabels.push(label);
|
||||||
try {
|
try {
|
||||||
// Verse session-cookie is verplicht; tray-tokens verlopen snel.
|
// Verse session-cookie is verplicht; tray-tokens verlopen snel.
|
||||||
let creds = account;
|
let creds = account;
|
||||||
|
|
@ -442,6 +451,8 @@ export async function resolveViaplayGuidPlay(
|
||||||
accountId: account.id,
|
accountId: account.id,
|
||||||
mediaPath: mediaPathOf(mpdUrl),
|
mediaPath: mediaPathOf(mpdUrl),
|
||||||
error: null,
|
error: null,
|
||||||
|
triedAccounts: triedLabels.length,
|
||||||
|
triedLabels,
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -455,17 +466,25 @@ export async function resolveViaplayGuidPlay(
|
||||||
};
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
lastError = err instanceof Error ? err : new Error(String(err));
|
lastError = err instanceof Error ? err : new Error(String(err));
|
||||||
|
attemptErrors.push(`${label}: ${lastError.message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const summary =
|
||||||
|
attemptErrors.length > 1
|
||||||
|
? `Alle ${attemptErrors.length} Viaplay-accounts mislukt (eigen cookies per account). Laatste: ${lastError?.message || "onbekend"}`
|
||||||
|
: lastError?.message || "Viaplay VOD-play mislukt";
|
||||||
|
|
||||||
recordVodPlay({
|
recordVodPlay({
|
||||||
guid,
|
guid,
|
||||||
ok: false,
|
ok: false,
|
||||||
title: null,
|
title: null,
|
||||||
accountId: null,
|
accountId: null,
|
||||||
mediaPath: null,
|
mediaPath: null,
|
||||||
error: lastError?.message || "Viaplay VOD-play mislukt",
|
error: summary,
|
||||||
|
triedAccounts: triedLabels.length,
|
||||||
|
triedLabels,
|
||||||
});
|
});
|
||||||
|
|
||||||
throw lastError || new AppError("UPSTREAM", "Viaplay VOD-play mislukt", 502);
|
throw new AppError("UPSTREAM", summary, 502);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue