From 6ec67bcfb8ba0ffe3fc24c4e50687cd30ce3bde1 Mon Sep 17 00:00:00 2001 From: aka paul <50n50@noreply.localhost> Date: Tue, 6 Jan 2026 20:27:33 +0000 Subject: [PATCH] Update anime-sama/anime-sama.js --- anime-sama/anime-sama.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/anime-sama/anime-sama.js b/anime-sama/anime-sama.js index d19a55f..bca7786 100644 --- a/anime-sama/anime-sama.js +++ b/anime-sama/anime-sama.js @@ -1,16 +1,38 @@ +async function getActiveDomain() { + try { + const response = await fetchv2("https://anime-sama.pw/"); + const html = await response.text(); + + const domainRegex = /
Actif<\/p>/;
+ const match = domainRegex.exec(html);
+
+ if (match) {
+ return match[1].trim();
+ } else {
+ return "anime-sama.tv";
+ }
+ } catch (err) {
+ console.error("Failed to fetch active domain:", err);
+ // Fallback
+ return "anime-sama.tv";
+ }
+}
+
async function searchResults(keyword) {
const results = [];
+ const activeDomain = await getActiveDomain();
+
const headers = {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
"X-Requested-With": "XMLHttpRequest",
- "referer": "https://anime-sama.org/"
+ "referer": `https://${activeDomain}/`
};
const regex = /]+href="([^"]+)"[\s\S]*?]+src="([^"]+)"[\s\S]*?
]*>(.*?)<\/h3>/gi;
try {
const response = await fetchv2(
- "https://anime-sama.eu/template-php/defaut/fetch.php",
+ `https://${activeDomain}/template-php/defaut/fetch.php`,
headers,
"POST",
`query=${encodeURIComponent(keyword)}`