mirror of
https://git.luna-app.eu/50n50/sources
synced 2026-01-12 01:18:11 +01:00
Update anime-sama/anime-sama.js
This commit is contained in:
parent
cafc9dea38
commit
6ec67bcfb8
1 changed files with 24 additions and 2 deletions
|
|
@ -1,16 +1,38 @@
|
|||
async function getActiveDomain() {
|
||||
try {
|
||||
const response = await fetchv2("https://anime-sama.pw/");
|
||||
const html = await response.text();
|
||||
|
||||
const domainRegex = /<td class="domain-name">([^<]+)<\/td>[\s\S]*?<p class="hidden md:block">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 = /<a[^>]+href="([^"]+)"[\s\S]*?<img[^>]+src="([^"]+)"[\s\S]*?<h3[^>]*>(.*?)<\/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)}`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue