fix
This commit is contained in:
+27
-39
@@ -128,6 +128,11 @@ async function extractEpisodes(movieUrl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function extractStreamUrl(url) {
|
async function extractStreamUrl(url) {
|
||||||
|
const headers = {
|
||||||
|
"Referer": "https://1movies.bz/",
|
||||||
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const eidMatch = url.match(/eid=([^&]+)/);
|
const eidMatch = url.match(/eid=([^&]+)/);
|
||||||
if (eidMatch && eidMatch[1]) {
|
if (eidMatch && eidMatch[1]) {
|
||||||
@@ -138,8 +143,7 @@ async function extractStreamUrl(url) {
|
|||||||
url = url.replace('&_=ENCRYPT_ME', `&_=${encryptedToken}`);
|
url = url.replace('&_=ENCRYPT_ME', `&_=${encryptedToken}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchUrl = `${url}`;
|
const response = await fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(url));
|
||||||
const response = await fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(fetchUrl));
|
|
||||||
const responseData = await response.json();
|
const responseData = await response.json();
|
||||||
const cleanedHtml = cleanJsonHtml(responseData.result);
|
const cleanedHtml = cleanJsonHtml(responseData.result);
|
||||||
|
|
||||||
@@ -153,12 +157,8 @@ async function extractStreamUrl(url) {
|
|||||||
|
|
||||||
const serverId = server1Match[1];
|
const serverId = server1Match[1];
|
||||||
|
|
||||||
const tokenPromises = [
|
const tokenData = await fetchv2(`https://enc-dec.app/api/enc-movies-flix?text=${encodeURIComponent(serverId)}`)
|
||||||
fetchv2(`https://enc-dec.app/api/enc-movies-flix?text=${encodeURIComponent(serverId)}`)
|
.then(res => res.json());
|
||||||
];
|
|
||||||
|
|
||||||
const tokenResponses = await Promise.all(tokenPromises);
|
|
||||||
const tokenData = await tokenResponses[0].json();
|
|
||||||
const token = tokenData.result;
|
const token = tokenData.result;
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
@@ -175,17 +175,21 @@ async function extractStreamUrl(url) {
|
|||||||
return "error";
|
return "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
const decryptPromises = [
|
// Fix: no encodeURIComponent, pass headers with browser UA
|
||||||
fetchv2("https://enc-dec.app/api/dec-movies-flix", { "Content-Type": "application/json" }, "POST", JSON.stringify({ text: streamData.result }))
|
const decryptData = await fetchv2(
|
||||||
];
|
`https://enc-dec.app/api/dec-movies-flix?text=${streamData.result}`,
|
||||||
|
headers
|
||||||
|
).then(res => res.json());
|
||||||
|
|
||||||
const decryptResponses = await Promise.all(decryptPromises);
|
const decryptedUrl = decryptData.result?.url;
|
||||||
const decryptData = await decryptResponses[0].json();
|
|
||||||
const decryptedUrl = decryptData.result.url;
|
if (!decryptedUrl) {
|
||||||
|
console.log("Decryption failed");
|
||||||
|
return "error";
|
||||||
|
}
|
||||||
|
|
||||||
const subListEncoded = decryptedUrl.split("sub.list=")[1]?.split("&")[0];
|
const subListEncoded = decryptedUrl.split("sub.list=")[1]?.split("&")[0];
|
||||||
let subtitles = "N/A";
|
let subtitles = "N/A";
|
||||||
|
|
||||||
if (subListEncoded) {
|
if (subListEncoded) {
|
||||||
try {
|
try {
|
||||||
const subListUrl = decodeURIComponent(subListEncoded);
|
const subListUrl = decodeURIComponent(subListEncoded);
|
||||||
@@ -200,16 +204,6 @@ async function extractStreamUrl(url) {
|
|||||||
? subtitles.find(sub => sub.label === "English")?.file.replace(/\\\//g, "/")
|
? subtitles.find(sub => sub.label === "English")?.file.replace(/\\\//g, "/")
|
||||||
: "N/A";
|
: "N/A";
|
||||||
|
|
||||||
if (!decryptedUrl) {
|
|
||||||
console.log("Decryption failed");
|
|
||||||
return "error";
|
|
||||||
}
|
|
||||||
|
|
||||||
const headers = {
|
|
||||||
"Referer": "https://1movies.bz/",
|
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"
|
|
||||||
};
|
|
||||||
|
|
||||||
const mediaResponse = await fetchv2(decryptedUrl.replace("/e/", "/media/"), headers);
|
const mediaResponse = await fetchv2(decryptedUrl.replace("/e/", "/media/"), headers);
|
||||||
const mediaJson = await mediaResponse.json();
|
const mediaJson = await mediaResponse.json();
|
||||||
|
|
||||||
@@ -219,17 +213,12 @@ async function extractStreamUrl(url) {
|
|||||||
return "error";
|
return "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
const postData = {
|
const finalJson = await fetchv2(
|
||||||
"text": result,
|
"https://enc-dec.app/api/dec-mega",
|
||||||
"agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"
|
{ "Content-Type": "application/json" },
|
||||||
};
|
"POST",
|
||||||
|
JSON.stringify({ text: result, agent: headers["User-Agent"] })
|
||||||
const finalPromises = [
|
).then(res => res.json());
|
||||||
fetchv2("https://enc-dec.app/api/dec-mega", { "Content-Type": "application/json" }, "POST", JSON.stringify(postData))
|
|
||||||
];
|
|
||||||
|
|
||||||
const finalResponses = await Promise.all(finalPromises);
|
|
||||||
const finalJson = await finalResponses[0].json();
|
|
||||||
|
|
||||||
const m3u8Link = finalJson?.result?.sources?.[0]?.file;
|
const m3u8Link = finalJson?.result?.sources?.[0]?.file;
|
||||||
|
|
||||||
@@ -254,11 +243,9 @@ async function extractStreamUrl(url) {
|
|||||||
|
|
||||||
if (i + 1 < lines.length) {
|
if (i + 1 < lines.length) {
|
||||||
const streamPath = lines[i + 1].trim();
|
const streamPath = lines[i + 1].trim();
|
||||||
const streamUrl = baseUrl + streamPath;
|
|
||||||
|
|
||||||
streams.push({
|
streams.push({
|
||||||
title: quality,
|
title: quality,
|
||||||
streamUrl: streamUrl
|
streamUrl: baseUrl + streamPath
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -270,6 +257,7 @@ async function extractStreamUrl(url) {
|
|||||||
};
|
};
|
||||||
console.log("RETURN: " + JSON.stringify(returnValue));
|
console.log("RETURN: " + JSON.stringify(returnValue));
|
||||||
return JSON.stringify(returnValue);
|
return JSON.stringify(returnValue);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Fetch error:" + error);
|
console.log("Fetch error:" + error);
|
||||||
return "https://error.org";
|
return "https://error.org";
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"name": "50/50",
|
"name": "50/50",
|
||||||
"icon": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ3122kQwublLkZ6rf1fEpUP79BxZOFmH9BSA&s"
|
"icon": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ3122kQwublLkZ6rf1fEpUP79BxZOFmH9BSA&s"
|
||||||
},
|
},
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"language": "English",
|
"language": "English",
|
||||||
"streamType": "HLS",
|
"streamType": "HLS",
|
||||||
"quality": "1080p",
|
"quality": "1080p",
|
||||||
|
|||||||
Reference in New Issue
Block a user