fix
Fetch and Save Remote Content / fetch (push) Successful in 24s
Sync Versions to index.json / sync-versions (push) Successful in 38s

This commit is contained in:
aka paul
2026-05-10 13:32:22 +02:00
parent aa56034bf7
commit c4fccf85bd
9 changed files with 298 additions and 52 deletions
+42 -2
View File
@@ -216,7 +216,47 @@ async function extractStreamUrl(url) {
if (file) {
const titleMap = { sub: "Hardsub English" };
streams.push({ title: titleMap[type] || type, streamUrl: "https://1anime.app/api/m3u8-proxy?url=" + file });
let pushedQualities = 0;
const baseTitle = titleMap[type] || type;
try {
const m3u8Response = await fetchv2("https://1anime.app/api/m3u8-proxy?url=" + encodeURIComponent(file));
const m3u8Text = await m3u8Response.text();
const lines = m3u8Text.split('\n');
for (let i = 0; i < lines.length; i++) {
const line = lines[i].trim();
if (line.startsWith('#EXT-X-STREAM-INF:')) {
const resolutionMatch = line.match(/RESOLUTION=(\d+x\d+)/);
let quality = 'Unknown';
if (resolutionMatch) {
const [width, height] = resolutionMatch[1].split('x');
quality = `${height}p`;
}
if (i + 1 < lines.length) {
let streamPath = lines[i + 1].trim();
let absolutePath;
if (streamPath.startsWith('/api/')) {
absolutePath = 'https://1anime.app' + streamPath;
} else if (streamPath.startsWith('http')) {
absolutePath = 'https://1anime.app/api/m3u8-proxy?url=' + encodeURIComponent(streamPath);
} else {
const baseUrl = file.substring(0, file.lastIndexOf('/') + 1);
absolutePath = 'https://1anime.app/api/m3u8-proxy?url=' + encodeURIComponent(baseUrl + streamPath);
}
streams.push({
title: `${quality} - ${baseTitle}`,
streamUrl: absolutePath
});
pushedQualities++;
}
}
}
} catch (e) {
console.log("Failed to extract qualities:", e);
}
if (pushedQualities === 0) {
streams.push({ title: baseTitle, streamUrl: "https://1anime.app/api/m3u8-proxy?url=" + encodeURIComponent(file) });
}
}
for (const track of tracks) {
@@ -230,7 +270,7 @@ async function extractStreamUrl(url) {
}
}));
return streams.length > 0 ? streams[0].streamUrl : "error";
return JSON.stringify({ streams, subtitles });
} catch (error) {
console.error("Animekai fetch error:" + error);
return "https://error.org";