Update animepahe/animepahe.js

This commit is contained in:
aka paul
2026-01-04 17:08:27 +00:00
parent e003f58b44
commit 0b00de663c
+10 -8
View File
@@ -129,15 +129,13 @@ async function extractStreamUrl(url) {
return JSON.stringify({ streams: [], subtitle: "" }); return JSON.stringify({ streams: [], subtitle: "" });
} }
const streams = []; const streamPromises = buttonMatches.map(async (buttonHtml) => {
for (const buttonHtml of buttonMatches) {
const srcMatch = buttonHtml.match(/data-src="([^"]*)"/); const srcMatch = buttonHtml.match(/data-src="([^"]*)"/);
const resMatch = buttonHtml.match(/data-resolution="([^"]*)"/); const resMatch = buttonHtml.match(/data-resolution="([^"]*)"/);
const audioMatch = buttonHtml.match(/data-audio="([^"]*)"/); const audioMatch = buttonHtml.match(/data-audio="([^"]*)"/);
const fansubMatch = buttonHtml.match(/data-fansub="([^"]*)"/); 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 kwikUrl = srcMatch[1];
const resolution = resMatch ? resMatch[1] : "Unknown"; const resolution = resMatch ? resMatch[1] : "Unknown";
@@ -171,21 +169,25 @@ async function extractStreamUrl(url) {
const audioType = audio === "eng" ? "Dub" : "Hardsub"; const audioType = audio === "eng" ? "Dub" : "Hardsub";
const title = `${resolution}p • ${audioType}`; const title = `${resolution}p • ${audioType}`;
streams.push({ return {
title: title, title: title,
streamUrl: hlsUrl, streamUrl: hlsUrl,
headers: { headers: {
"Referer": "https://kwik.cx/", "Referer": "https://kwik.cx/",
"Origin": "https://kwik.cx" "Origin": "https://kwik.cx"
} }
}); };
} }
} }
} }
} catch (e) { } catch (e) {
continue; // Continue to next
} }
} return null;
});
const streamResults = await Promise.all(streamPromises);
const streams = streamResults.filter(s => s !== null);
return JSON.stringify({ return JSON.stringify({
streams: streams, streams: streams,