Update animepahe/animepahe.js

This commit is contained in:
aka paul 2026-01-04 17:08:27 +00:00
parent e003f58b44
commit 0b00de663c

View file

@ -129,15 +129,13 @@ async function extractStreamUrl(url) {
return JSON.stringify({ streams: [], subtitle: "" });
}
const streams = [];
for (const buttonHtml of buttonMatches) {
const streamPromises = buttonMatches.map(async (buttonHtml) => {
const srcMatch = buttonHtml.match(/data-src="([^"]*)"/);
const resMatch = buttonHtml.match(/data-resolution="([^"]*)"/);
const audioMatch = buttonHtml.match(/data-audio="([^"]*)"/);
const fansubMatch = buttonHtml.match(/data-fansub="([^"]*)"/);
if (!srcMatch || !srcMatch[1].includes('kwik.cx')) continue;
if (!srcMatch || !srcMatch[1].includes('kwik.cx')) return null;
const kwikUrl = srcMatch[1];
const resolution = resMatch ? resMatch[1] : "Unknown";
@ -171,21 +169,25 @@ async function extractStreamUrl(url) {
const audioType = audio === "eng" ? "Dub" : "Hardsub";
const title = `${resolution}p • ${audioType}`;
streams.push({
return {
title: title,
streamUrl: hlsUrl,
headers: {
"Referer": "https://kwik.cx/",
"Origin": "https://kwik.cx"
}
});
};
}
}
}
} catch (e) {
continue;
// Continue to next
}
}
return null;
});
const streamResults = await Promise.all(streamPromises);
const streams = streamResults.filter(s => s !== null);
return JSON.stringify({
streams: streams,