Update animeler/animeler.js

This commit is contained in:
aka paul 2025-11-06 13:52:57 +00:00
parent 02a82fcf28
commit 8a333cb408

View file

@ -82,34 +82,51 @@ async function extractStreamUrl(url) {
const match = html.match(/<iframe[^>]+src=['"](https:\/\/play\.animeler\.pw\/fireplayer\/video\/([a-f0-9]+))['"]/i); const match = html.match(/<iframe[^>]+src=['"](https:\/\/play\.animeler\.pw\/fireplayer\/video\/([a-f0-9]+))['"]/i);
if (match) { if (match) {
const url = match[1]; const fireplayerUrl = match[1];
const hash = match[2]; const hash = match[2];
const postData = "hash=" + hash + "&r=https%3A%2F%2Fanimeler.pw%2F&s="; const postData = "hash=" + hash + "&r=https%3A%2F%2Fanimeler.pw%2F&s=";
const headers = { const headers = {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Origin': 'https://play.animeler.pw', 'Origin': 'https://play.animeler.pw',
'Referer': url, 'Referer': fireplayerUrl,
'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', '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" "X-Requested-With": "XMLHttpRequest"
}; };
const streamResponse = await fetchv2(url + "?do=getVideo", headers, "POST", postData); const streamResponse = await fetchv2(fireplayerUrl + "?do=getVideo", headers, "POST", postData);
const streamData = await streamResponse.json(); const streamData = await streamResponse.json();
const sibnetUrl = streamData.videoSrc; const sibnetUrl = streamData.videoSrc;
const headersv2 = { const streamHeaders = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)', "Host": "dv32-1.sibnet.ru",
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:145.0) Gecko/20100101 Firefox/145.0",
'Accept-Language': 'en-US,en;q=0.5', "Accept": "video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5",
'Accept-Encoding': 'gzip, deflate, br' "Accept-Language": "en-US,en;q=0.5",
"Accept-Encoding": "gzip, deflate, br, zstd, identity",
"Range": "bytes=0-",
"Referer": "https://video.sibnet.ru/",
"Connection": "keep-alive",
"Sec-Fetch-Dest": "video",
"Sec-Fetch-Mode": "no-cors",
"Sec-Fetch-Site": "same-site",
"Priority": "u=0"
}; };
const finalResponse = await fetchv2("https://kisskh-five.vercel.app/api/proxy?url=" + sibnetUrl, headersv2); const subtitleUrl = "https://none.com/subtitles.vtt";
const finalHtml = await finalResponse.text();
const result = await sibnetExtractor(finalHtml, sibnetUrl); const data = await sibnetExtractor(sibnetUrl);
return result;
return JSON.stringify({
streams: [
{
title: "Server 1",
streamUrl: data ? data.url : 'deijdiw',
headers: streamHeaders
}
],
subtitle: subtitleUrl
});
} }
return JSON.stringify({ return JSON.stringify({
@ -124,16 +141,19 @@ async function extractStreamUrl(url) {
} }
} }
async function sibnetExtractor(embedUrl) {
const headers = {
Referer: embedUrl
};
/* SCHEME START */
/**
* @name sibnetExtractor
* @author scigward
*/
async function sibnetExtractor(html, embedUrl) {
try { try {
const response = await soraFetch(embedUrl, {
headers,
method: 'GET',
encoding: 'windows-1251'
});
const html = await response.text();
const videoMatch = html.match( const videoMatch = html.match(
/player\.src\s*\(\s*\[\s*\{\s*src\s*:\s*["']([^"']+)["']/i /player\.src\s*\(\s*\[\s*\{\s*src\s*:\s*["']([^"']+)["']/i
); );
@ -147,37 +167,51 @@ async function sibnetExtractor(html, embedUrl) {
? videoPath ? videoPath
: `https://video.sibnet.ru${videoPath}`; : `https://video.sibnet.ru${videoPath}`;
return JSON.stringify({ return {
streams: [ url: videoUrl,
{ headers: headers
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) { } catch (error) {
console.log("SibNet extractor error: " + error.message); console.log("SibNet extractor error: " + error.message);
return JSON.stringify({ return null;
streams: [],
subtitle: ""
});
} }
} }
/* SCHEME END */
async function soraFetch(url, options = { headers: {}, method: 'GET', body: null, encoding: 'utf-8' }) {
try {
return await fetchv2(
url,
options.headers ?? {},
options.method ?? 'GET',
options.body ?? null,
true,
options.encoding ?? 'utf-8'
);
} catch(e) {
try {
return await fetch(url, options);
} catch(error) {
return null;
}
}
}
function decodeHTMLEntities(text) {
text = text.replace(/&#(\d+);/g, (match, dec) => String.fromCharCode(dec));
const entities = {
'&quot;': '"',
'&amp;': '&',
'&apos;': "'",
'&lt;': '<',
'&gt;': '>'
};
for (const entity in entities) {
text = text.replace(new RegExp(entity, 'g'), entities[entity]);
}
return text;
}