mirror of
https://git.luna-app.eu/50n50/sources
synced 2025-12-21 21:26:19 +01:00
Add animeler/animeler.js
This commit is contained in:
parent
f8662f73ad
commit
8c36ec5e7c
1 changed files with 183 additions and 0 deletions
183
animeler/animeler.js
Normal file
183
animeler/animeler.js
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
async function searchResults(keyword) {
|
||||
const results = [];
|
||||
try {
|
||||
const response = await fetchv2("https://animeler.pw/wp-json/kiranime/v1/anime/search?query=" + encodeURIComponent(keyword) + "&lang=jp&_locale=user");
|
||||
const data = await response.json();
|
||||
const html = data.result;
|
||||
|
||||
const regex = /<a href="([^"]+)"[^>]*>[\s\S]*?<img[^>]+src='([^']+)'[^>]*>[\s\S]*?<h3[^>]*>([^<]+)<\/h3>/g;
|
||||
let match;
|
||||
|
||||
while ((match = regex.exec(html)) !== null) {
|
||||
results.push({
|
||||
title: match[3].trim(),
|
||||
image: match[2].trim(),
|
||||
href: match[1].trim()
|
||||
});
|
||||
}
|
||||
|
||||
return JSON.stringify(results);
|
||||
} catch (err) {
|
||||
return JSON.stringify([{
|
||||
title: "Error",
|
||||
image: "Error",
|
||||
href: "Error"
|
||||
}]);
|
||||
}
|
||||
}
|
||||
|
||||
async function extractDetails(url) {
|
||||
try {
|
||||
const response = await fetchv2(url);
|
||||
const html = await response.text();
|
||||
|
||||
const regex = /<div[^>]*data-synopsis=""[^>]*>([\s\S]*?)<\/div>/;
|
||||
const match = html.match(regex);
|
||||
const description = match ? match[1].trim() : "N/A";
|
||||
|
||||
return JSON.stringify([{
|
||||
description: description,
|
||||
aliases: "N/A",
|
||||
airdate: "N/A"
|
||||
}]);
|
||||
} catch (err) {
|
||||
return JSON.stringify([{
|
||||
description: "Error",
|
||||
aliases: "Error",
|
||||
airdate: "Error"
|
||||
}]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function extractEpisodes(url) {
|
||||
const results = [];
|
||||
try {
|
||||
const response = await fetchv2(url);
|
||||
const html = await response.text();
|
||||
|
||||
const regex = /<div\s+class="swiper-slide[^"]*"[^>]*>\s*<a\s+href="(https:\/\/animeler\.pw\/[^"]+)"[^>]*title="[^"]*"[^>]*class="w-full[^"]*"[^>]*>[\s\S]*?<span[^>]*>\s*Bölüm\s+(\d+)\s*<\/span>[\s\S]*?<\/a>/gi;
|
||||
let match;
|
||||
|
||||
while ((match = regex.exec(html)) !== null) {
|
||||
results.push({
|
||||
href: match[1].trim(),
|
||||
number: parseInt(match[2], 10)
|
||||
});
|
||||
}
|
||||
|
||||
return JSON.stringify(results.reverse());
|
||||
} catch (err) {
|
||||
return JSON.stringify([{
|
||||
href: "Error",
|
||||
number: "Error"
|
||||
}]);
|
||||
}
|
||||
}
|
||||
|
||||
async function extractStreamUrl(url) {
|
||||
try {
|
||||
const response = await fetchv2(url);
|
||||
const html = await response.text();
|
||||
|
||||
const match = html.match(/<iframe[^>]+src=['"](https:\/\/play\.animeler\.pw\/fireplayer\/video\/([a-f0-9]+))['"]/i);
|
||||
if (match) {
|
||||
const url = match[1];
|
||||
const hash = match[2];
|
||||
|
||||
const postData = "hash=" + hash + "&r=https%3A%2F%2Fanimeler.pw%2F&s=";
|
||||
const headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
'Origin': 'https://play.animeler.pw',
|
||||
'Referer': url,
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
};
|
||||
|
||||
const streamResponse = await fetchv2(url + "?do=getVideo", headers, "POST", postData);
|
||||
const streamData = await streamResponse.json();
|
||||
|
||||
const sibnetUrl = streamData.videoSrc;
|
||||
const headersv2 = {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)',
|
||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
||||
'Accept-Language': 'en-US,en;q=0.5',
|
||||
'Accept-Encoding': 'gzip, deflate, br'
|
||||
};
|
||||
|
||||
const finalResponse = await fetchv2("https://kisskh-five.vercel.app/api/proxy?url=" + sibnetUrl, headersv2);
|
||||
const finalHtml = await finalResponse.text();
|
||||
|
||||
const result = await sibnetExtractor(finalHtml, sibnetUrl);
|
||||
return result;
|
||||
}
|
||||
|
||||
return JSON.stringify({
|
||||
streams: [],
|
||||
subtitle: ""
|
||||
});
|
||||
} catch (err) {
|
||||
return JSON.stringify({
|
||||
streams: [],
|
||||
subtitle: ""
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* SCHEME START */
|
||||
|
||||
/**
|
||||
* @name sibnetExtractor
|
||||
* @author scigward
|
||||
*/
|
||||
|
||||
async function sibnetExtractor(html, embedUrl) {
|
||||
try {
|
||||
const videoMatch = html.match(
|
||||
/player\.src\s*\(\s*\[\s*\{\s*src\s*:\s*["']([^"']+)["']/i
|
||||
);
|
||||
|
||||
if (!videoMatch || !videoMatch[1]) {
|
||||
throw new Error("Sibnet video source not found");
|
||||
}
|
||||
|
||||
const videoPath = videoMatch[1];
|
||||
const videoUrl = videoPath.startsWith("http")
|
||||
? videoPath
|
||||
: `https://video.sibnet.ru${videoPath}`;
|
||||
|
||||
return JSON.stringify({
|
||||
streams: [
|
||||
{
|
||||
title: "Sibnet",
|
||||
streamUrl: videoUrl,
|
||||
headers: {
|
||||
"Host": "video.sibnet.ru",
|
||||
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:145.0) Gecko/20100101 Firefox/145.0",
|
||||
"Accept": "video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5",
|
||||
"Accept-Language": "en-US,en;q=0.5",
|
||||
"Referer": embedUrl,
|
||||
"Range": "bytes=0-",
|
||||
"Connection": "keep-alive",
|
||||
"Sec-Fetch-Dest": "video",
|
||||
"Sec-Fetch-Mode": "no-cors",
|
||||
"Sec-Fetch-Site": "same-origin",
|
||||
"Accept-Encoding": "identity",
|
||||
"Priority": "u=0"
|
||||
}
|
||||
}
|
||||
],
|
||||
subtitle: ""
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("SibNet extractor error: " + error.message);
|
||||
return JSON.stringify({
|
||||
streams: [],
|
||||
subtitle: ""
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* SCHEME END */
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue