update
This commit is contained in:
+46
-34
@@ -650,7 +650,16 @@ async function extractStreamUrl(url) {
|
||||
|
||||
async function getStream(url) {
|
||||
try {
|
||||
const response = await fetchv2(url.replace("/e/", "/media/"), headers);
|
||||
if (url.includes("anikai.to/iframe")) {
|
||||
const iframePageRes = await fetchv2(url, headers);
|
||||
const iframePageText = await iframePageRes.text();
|
||||
const iframeSrcMatch = iframePageText.match(/<iframe[^>]+src="([^"]+)"/i);
|
||||
if (iframeSrcMatch && iframeSrcMatch[1]) {
|
||||
url = iframeSrcMatch[1];
|
||||
}
|
||||
}
|
||||
|
||||
const response = await fetchv2(url.replace("/e/", "/media/").replace("/e2/", "/media/"), headers);
|
||||
const responseJson = await response.json();
|
||||
const result = responseJson?.result;
|
||||
const finalResponse = await fetchv2(
|
||||
@@ -673,9 +682,9 @@ async function extractStreamUrl(url) {
|
||||
]);
|
||||
|
||||
const streams = [];
|
||||
if (subStream) streams.push({ title: "Hardsub English", streamUrl: subStream });
|
||||
if (dubStream) streams.push({ title: "Dubbed English", streamUrl: dubStream });
|
||||
if (rawStream) streams.push({ title: "Original audio", streamUrl: rawStream });
|
||||
if (subStream) streams.push({ title: "Hardsub English", streamUrl: "https://1anime.app/api/m3u8-proxy?url=" + subStream });
|
||||
if (dubStream) streams.push({ title: "Dubbed English", streamUrl: "https://1anime.app/api/m3u8-proxy?url=" + dubStream });
|
||||
if (rawStream) streams.push({ title: "Original audio", streamUrl: "https://1anime.app/api/m3u8-proxy?url=" + rawStream });
|
||||
|
||||
const final = { streams, subtitles: "" };
|
||||
console.log("RETURN: " + JSON.stringify(final));
|
||||
@@ -702,19 +711,21 @@ async function extractStreamUrl(url) {
|
||||
actualUrl = actualUrl.replace('&_=ENCRYPT_ME', `&_=${encryptedToken}`);
|
||||
}
|
||||
|
||||
const response = await fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(actualUrl));
|
||||
const response = await fetchv2(actualUrl);
|
||||
const responseData = await response.json();
|
||||
const cleanedHtml = cleanJsonHtml(responseData.result);
|
||||
|
||||
const server1Regex = /<div class="server wnav-item"[^>]*data-lid="([^"]+)"[^>]*>\s*<span>Server 1<\/span>/;
|
||||
const server1Match = server1Regex.exec(cleanedHtml);
|
||||
const spanRegex = /<div class="server wnav-item"[^>]*data-lid="([^"]+)"[^>]*>/g;
|
||||
const ids = [];
|
||||
let match;
|
||||
while ((match = spanRegex.exec(cleanedHtml)) !== null) ids.push(match[1]);
|
||||
|
||||
if (!server1Match) {
|
||||
console.log("Server 1 not found");
|
||||
if (ids.length === 0) {
|
||||
console.log("No servers found");
|
||||
return "error";
|
||||
}
|
||||
|
||||
const serverId = server1Match[1];
|
||||
const serverId = ids.length > 1 ? ids[1] : ids[0];
|
||||
const tokenData = await fetchv2(`https://enc-dec.app/api/enc-movies-flix?text=${encodeURIComponent(serverId)}`)
|
||||
.then(res => res.json());
|
||||
const token = tokenData.result;
|
||||
@@ -725,7 +736,7 @@ async function extractStreamUrl(url) {
|
||||
}
|
||||
|
||||
const streamUrl = `https://1movies.bz/ajax/links/view?id=${serverId}&_=${token}`;
|
||||
const streamResponse = await fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(streamUrl));
|
||||
const streamResponse = await fetchv2(streamUrl);
|
||||
const streamData = await streamResponse.json();
|
||||
|
||||
if (!streamData.result) {
|
||||
@@ -762,7 +773,25 @@ async function extractStreamUrl(url) {
|
||||
? subtitles.find(sub => sub.label === "English")?.file.replace(/\\\//g, "/")
|
||||
: "N/A";
|
||||
|
||||
const mediaResponse = await fetchv2(decryptedUrl.replace("/e/", "/media/"), headers);
|
||||
let finalUrl = decryptedUrl;
|
||||
if (finalUrl.includes(".to/iframe")) {
|
||||
try {
|
||||
const iframeResponse = await fetchv2(finalUrl, headers);
|
||||
const iframeHtml = await iframeResponse.text();
|
||||
const iframeSrcMatch = iframeHtml.match(/<iframe[^>]+src="([^"]+)"/i);
|
||||
if (iframeSrcMatch && iframeSrcMatch[1]) {
|
||||
finalUrl = iframeSrcMatch[1];
|
||||
} else {
|
||||
console.log("No iframe src found in:", finalUrl);
|
||||
return "error";
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Error fetching iframe:", e);
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
|
||||
const mediaResponse = await fetchv2(finalUrl.replace("/e/", "/media/"), headers);
|
||||
const mediaJson = await mediaResponse.json();
|
||||
const result = mediaJson?.result;
|
||||
|
||||
@@ -775,29 +804,12 @@ async function extractStreamUrl(url) {
|
||||
const finalJson = JSON.parse(await finalResponse.text());
|
||||
|
||||
const m3u8Link = finalJson?.result?.sources?.[0]?.file;
|
||||
const m3u8Response = await fetchv2(m3u8Link);
|
||||
const m3u8Text = await m3u8Response.text();
|
||||
|
||||
const baseUrl = m3u8Link.substring(0, m3u8Link.lastIndexOf('/') + 1);
|
||||
const streams = [];
|
||||
const lines = m3u8Text.split('\n');
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i].trim();
|
||||
if (line.startsWith('#EXT-X-STREAM-INF:')) {
|
||||
const resolutionMatch = line.match(/RESOLUTION=(\d+x\d+)/);
|
||||
let quality = 'Unknown';
|
||||
if (resolutionMatch) {
|
||||
const [width, height] = resolutionMatch[1].split('x');
|
||||
quality = `${height}p`;
|
||||
}
|
||||
if (i + 1 < lines.length) {
|
||||
streams.push({
|
||||
title: quality,
|
||||
streamUrl: baseUrl + lines[i + 1].trim()
|
||||
});
|
||||
}
|
||||
}
|
||||
if (m3u8Link) {
|
||||
streams.push({
|
||||
title: "Auto",
|
||||
streamUrl: "https://1anime.app/api/m3u8-proxy?url=" + m3u8Link
|
||||
});
|
||||
}
|
||||
|
||||
const returnValue = {
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
"name": "50/50",
|
||||
"icon": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ3122kQwublLkZ6rf1fEpUP79BxZOFmH9BSA&s"
|
||||
},
|
||||
"version": "1.3.1",
|
||||
"version": "1.3.2",
|
||||
"language": "English",
|
||||
"streamType": "HLS",
|
||||
"quality": "1080p",
|
||||
|
||||
Reference in New Issue
Block a user