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 [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 = [];
|
||||
let subtitle = null;
|
||||
|
|
@ -240,30 +248,31 @@ async function extractStreamUrl(ID) {
|
|||
headers: alphaResult.data.referer ? { "Referer": alphaResult.data.referer } : {}
|
||||
});
|
||||
} 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 streams = epsilonResult.data.streams;
|
||||
let fourKUrl = null;
|
||||
if (epsilonResult && !epsilonResult.error && epsilonResult.data && epsilonResult.data.streams) {
|
||||
const epsilonStreams = epsilonResult.data.streams;
|
||||
let epsilonFourKUrl = null;
|
||||
|
||||
for (const stream of streams) {
|
||||
if (stream.title && stream.title.includes('4K') && stream.streamUrl) {
|
||||
fourKUrl = stream;
|
||||
break;
|
||||
for (const stream of epsilonStreams) {
|
||||
if (stream.title && stream.title.includes('4K') && stream.streamUrl) {
|
||||
epsilonFourKUrl = stream;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (epsilonFourKUrl) {
|
||||
console.log('Using epsilon as 4K fallback provider');
|
||||
resultStreams.push({
|
||||
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({
|
||||
streams: resultStreams,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue