update
This commit is contained in:
@@ -66,7 +66,7 @@ async function extractEpisodes(url) {
|
||||
server.server_data?.forEach(ep => {
|
||||
results.push({
|
||||
number: parseInt(ep.name, 10),
|
||||
href: "https://anibd.app/playid/" + postid + "/?server=" + server.id + "&slug=" + ep.slug
|
||||
href: "https://epeng.animeapps.top/apilink.php?data=" + ep.link
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -79,26 +79,45 @@ async function extractEpisodes(url) {
|
||||
|
||||
async function extractStreamUrl(url) {
|
||||
try {
|
||||
const pageHtml = await (await fetchv2(url)).text();
|
||||
const iframeUrl = pageHtml.match(/id="video-player-iframe"\s+src="([^"]+)"/)?.[1]?.replace(/&/g, '&');
|
||||
if (!iframeUrl) return JSON.stringify({ streams: [], subtitle: "" });
|
||||
|
||||
const iframeHtml = await (await fetchv2(iframeUrl, { "Referer": "https://anibd.app/" })).text();
|
||||
let streamUrl = iframeHtml.match(/url:\s*['"]([^'"]+\.m3u8)['"]/)?.[1] || iframeHtml.match(/videoUrl:\s*["']([^"']+\.m3u8)['"]/)?.[1];
|
||||
|
||||
if (streamUrl) {
|
||||
const fullUrl = streamUrl.startsWith("/") ? "https://playeng.animeapps.top" + streamUrl : streamUrl.startsWith("http") ? streamUrl : "https://playeng.animeapps.top/r2/" + streamUrl;
|
||||
return JSON.stringify({
|
||||
streams: [{
|
||||
title: "Server 1",
|
||||
streamUrl: fullUrl,
|
||||
headers: { "Referer": "https://anibd.app/" }
|
||||
}],
|
||||
subtitle: ""
|
||||
});
|
||||
}
|
||||
return JSON.stringify({ streams: [], subtitle: "" });
|
||||
const response = await fetchv2(url);
|
||||
const servers = await response.json();
|
||||
const headers = {
|
||||
"Referer": "https://anibd.app/"
|
||||
};
|
||||
|
||||
const promises = servers.map(async (server) => {
|
||||
try {
|
||||
const res = await fetchv2(server.link, headers);
|
||||
const html = await res.text();
|
||||
const match = html.match(/url:\s*['"]([^'"]+)['"]/);
|
||||
if (match) {
|
||||
let streamUrl = match[1];
|
||||
if (!streamUrl.startsWith("http")) {
|
||||
const baseUrl = server.link.substring(0, server.link.lastIndexOf("/") + 1);
|
||||
streamUrl = baseUrl + streamUrl;
|
||||
}
|
||||
return {
|
||||
title: server.server,
|
||||
streamUrl: streamUrl
|
||||
};
|
||||
}
|
||||
} catch (err) {}
|
||||
return null;
|
||||
});
|
||||
|
||||
const results = await Promise.all(promises);
|
||||
const streams = results.filter(s => s !== null);
|
||||
|
||||
return JSON.stringify({
|
||||
type: "servers",
|
||||
streams: streams,
|
||||
subtitle: null
|
||||
});
|
||||
} catch (err) {
|
||||
return JSON.stringify({ streams: [], subtitle: "" });
|
||||
return JSON.stringify({
|
||||
type: "servers",
|
||||
streams: [],
|
||||
subtitle: null
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user