mirror of
https://git.luna-app.eu/50n50/sources
synced 2025-12-21 21:26:19 +01:00
Update checkmate/checkmate.js
This commit is contained in:
parent
efeaad722a
commit
7f7b5c9444
1 changed files with 31 additions and 22 deletions
|
|
@ -192,7 +192,15 @@ async function extractStreamUrl(ID) {
|
||||||
|
|
||||||
const racePromise = Promise.race([alphaPromise, gammaPromise, deltaPromise]);
|
const racePromise = Promise.race([alphaPromise, gammaPromise, deltaPromise]);
|
||||||
|
|
||||||
const [fastestResult, betaResult, alphaResult, epsilonResult] = await Promise.all([racePromise, betaPromise, alphaPromise, epsilonPromise]);
|
const [fastestResult, betaResult, alphaResult] = await Promise.all([racePromise, betaPromise, alphaPromise]);
|
||||||
|
|
||||||
|
let epsilonResult = null;
|
||||||
|
const alphaHas4K = alphaResult && !alphaResult.error && alphaResult.data && alphaResult.data.streams &&
|
||||||
|
alphaResult.data.streams.some((_, i, arr) => i % 2 === 0 && arr[i] && arr[i].toLowerCase().includes('4k'));
|
||||||
|
|
||||||
|
if (!alphaHas4K) {
|
||||||
|
epsilonResult = await epsilonPromise;
|
||||||
|
}
|
||||||
|
|
||||||
const resultStreams = [];
|
const resultStreams = [];
|
||||||
let subtitle = null;
|
let subtitle = null;
|
||||||
|
|
@ -240,30 +248,31 @@ async function extractStreamUrl(ID) {
|
||||||
headers: alphaResult.data.referer ? { "Referer": alphaResult.data.referer } : {}
|
headers: alphaResult.data.referer ? { "Referer": alphaResult.data.referer } : {}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log('Alpha did not return a 4K stream');
|
console.log('Alpha did not return a 4K stream, checking epsilon as fallback');
|
||||||
}
|
|
||||||
}
|
if (epsilonResult && !epsilonResult.error && epsilonResult.data && epsilonResult.data.streams) {
|
||||||
|
const epsilonStreams = epsilonResult.data.streams;
|
||||||
|
let epsilonFourKUrl = null;
|
||||||
|
|
||||||
if (epsilonResult && !epsilonResult.error && epsilonResult.data && epsilonResult.data.streams) {
|
for (const stream of epsilonStreams) {
|
||||||
const streams = epsilonResult.data.streams;
|
if (stream.title && stream.title.includes('4K') && stream.streamUrl) {
|
||||||
let fourKUrl = null;
|
epsilonFourKUrl = stream;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (const stream of streams) {
|
if (epsilonFourKUrl) {
|
||||||
if (stream.title && stream.title.includes('4K') && stream.streamUrl) {
|
console.log('Using epsilon as 4K fallback provider');
|
||||||
fourKUrl = stream;
|
resultStreams.push({
|
||||||
break;
|
title: "4K",
|
||||||
|
streamUrl: epsilonFourKUrl.streamUrl,
|
||||||
|
headers: epsilonFourKUrl.headers || { "Referer": "https://mapple.uk/", "Origin": "https://mapple.uk" }
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log('Epsilon fallback also did not return a 4K stream');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fourKUrl) {
|
|
||||||
resultStreams.push({
|
|
||||||
title: "4K Secondary",
|
|
||||||
streamUrl: fourKUrl.streamUrl,
|
|
||||||
headers: fourKUrl.headers || { "Referer": "https://mapple.uk/", "Origin": "https://mapple.uk" }
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.log('Epsilon did not return a 4K stream');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
console.log(JSON.stringify({
|
console.log(JSON.stringify({
|
||||||
streams: resultStreams,
|
streams: resultStreams,
|
||||||
|
|
@ -7490,4 +7499,4 @@ function uint8ArrayToBase64Url(bytes) {
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Veni Vidi Veci
|
// Veni Vidi Veci
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue