2025-10-11 17:18:45 +02:00
|
|
|
async function searchResults(keyword) {
|
|
|
|
|
const results = [];
|
|
|
|
|
try {
|
2026-04-17 12:14:39 +00:00
|
|
|
const response = await fetchv2("https://eng.animeapps.top/api/search2.php?keyword=" + encodeURIComponent(keyword) + "&page=1&limit=200");
|
|
|
|
|
const json = await response.json();
|
|
|
|
|
|
|
|
|
|
if (json.status === "success" && json.data) {
|
|
|
|
|
json.data.forEach(item => {
|
|
|
|
|
let title = item.postname.trim();
|
|
|
|
|
title = title.replace(/\s*\(Uncensored\)\s*$/i, '');
|
|
|
|
|
title = title.replace(/\s*BD\s*$/i, '');
|
|
|
|
|
title = title.trim();
|
|
|
|
|
|
|
|
|
|
results.push({
|
|
|
|
|
title: title,
|
|
|
|
|
image: item.ani_cover_large,
|
|
|
|
|
href: "https://anibd.app/" + item.postid + "?anilist=" + item.anilist
|
|
|
|
|
});
|
2025-10-11 17:18:45 +02:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return JSON.stringify(results);
|
|
|
|
|
} catch (err) {
|
|
|
|
|
return JSON.stringify([{
|
|
|
|
|
title: "Error",
|
|
|
|
|
image: "Error",
|
|
|
|
|
href: "Error"
|
|
|
|
|
}]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function extractDetails(url) {
|
|
|
|
|
try {
|
2026-04-17 12:14:39 +00:00
|
|
|
const html = await (await fetchv2(url)).text();
|
|
|
|
|
const match = html.match(/<div class="full-description">[\s\S]*?<h4[^>]*>Synopsis<\/h4>([\s\S]*?)<\/div>/);
|
2025-10-11 17:18:45 +02:00
|
|
|
let description = "N/A";
|
|
|
|
|
if (match && match[1]) {
|
|
|
|
|
description = match[1]
|
2026-04-17 12:14:39 +00:00
|
|
|
.replace(/<p[^>]*>/g, '').replace(/<\/p>/g, ' ').replace(/<br\s*\/?>/gi, ' ')
|
|
|
|
|
.replace(/<[^>]*>/g, '').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"')
|
|
|
|
|
.replace(/&/g, '&').replace(/'/g, "'").replace(/ /g, ' ')
|
|
|
|
|
.replace(/\(Source:.*?\)\s*/gi, '').replace(/\s+/g, ' ').trim();
|
2025-10-11 17:18:45 +02:00
|
|
|
}
|
2026-04-17 12:14:39 +00:00
|
|
|
return JSON.stringify([{ description, aliases: "N/A", airdate: "N/A" }]);
|
2025-10-11 17:18:45 +02:00
|
|
|
} catch (err) {
|
2026-04-17 12:14:39 +00:00
|
|
|
return JSON.stringify([{ description: "Error", aliases: "Error", airdate: "Error" }]);
|
2025-10-11 17:18:45 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function extractEpisodes(url) {
|
|
|
|
|
try {
|
2026-04-17 12:14:39 +00:00
|
|
|
const postid = url.match(/(\d+)/)?.[1];
|
|
|
|
|
if (!postid) return JSON.stringify([]);
|
2025-10-11 17:18:45 +02:00
|
|
|
|
2026-04-17 12:14:39 +00:00
|
|
|
let anilist = url.match(/anilist=([\d]+)/)?.[1];
|
|
|
|
|
if (!anilist) {
|
|
|
|
|
const html = await (await fetchv2(url)).text();
|
|
|
|
|
anilist = html.match(/const\s+EP_ID\s*=\s*["'](\d+)["']/)?.[1];
|
|
|
|
|
}
|
|
|
|
|
if (!anilist) return JSON.stringify([]);
|
2025-10-11 17:18:45 +02:00
|
|
|
|
2026-04-17 12:14:39 +00:00
|
|
|
const json = await (await fetchv2("https://epeng.animeapps.top/api2.php?epid=" + anilist)).json();
|
|
|
|
|
const results = [];
|
|
|
|
|
if (Array.isArray(json)) {
|
|
|
|
|
json.forEach(server => {
|
|
|
|
|
server.server_data?.forEach(ep => {
|
|
|
|
|
results.push({
|
|
|
|
|
number: parseInt(ep.name, 10),
|
|
|
|
|
href: "https://anibd.app/playid/" + postid + "/?server=" + server.id + "&slug=" + ep.slug
|
|
|
|
|
});
|
|
|
|
|
});
|
2025-10-11 17:18:45 +02:00
|
|
|
});
|
|
|
|
|
}
|
2026-04-17 12:14:39 +00:00
|
|
|
return JSON.stringify(results);
|
2025-10-11 17:18:45 +02:00
|
|
|
} catch (err) {
|
2026-04-17 12:14:39 +00:00
|
|
|
return JSON.stringify([]);
|
2025-10-11 17:18:45 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function extractStreamUrl(url) {
|
|
|
|
|
try {
|
2026-04-17 12:14:39 +00:00
|
|
|
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();
|
2026-04-17 18:46:51 +00:00
|
|
|
let streamUrl = iframeHtml.match(/url:\s*['"]([^'"]+\.m3u8)['"]/)?.[1] || iframeHtml.match(/videoUrl:\s*["']([^"']+\.m3u8)['"]/)?.[1];
|
2026-04-17 12:14:39 +00:00
|
|
|
|
|
|
|
|
if (streamUrl) {
|
2026-04-17 18:46:51 +00:00
|
|
|
const fullUrl = streamUrl.startsWith("/") ? "https://playeng.animeapps.top" + streamUrl : streamUrl.startsWith("http") ? streamUrl : "https://playeng.animeapps.top/r2/" + streamUrl;
|
2026-04-17 12:14:39 +00:00
|
|
|
return JSON.stringify({
|
|
|
|
|
streams: [{
|
|
|
|
|
title: "Server 1",
|
2026-04-17 18:46:51 +00:00
|
|
|
streamUrl: fullUrl,
|
2026-04-17 12:14:39 +00:00
|
|
|
headers: { "Referer": "https://anibd.app/" }
|
|
|
|
|
}],
|
|
|
|
|
subtitle: ""
|
|
|
|
|
});
|
2025-10-11 17:18:45 +02:00
|
|
|
}
|
2026-04-17 12:14:39 +00:00
|
|
|
return JSON.stringify({ streams: [], subtitle: "" });
|
2025-10-11 17:18:45 +02:00
|
|
|
} catch (err) {
|
2026-04-17 12:14:39 +00:00
|
|
|
return JSON.stringify({ streams: [], subtitle: "" });
|
2025-10-11 17:18:45 +02:00
|
|
|
}
|
|
|
|
|
}
|