fix
This commit is contained in:
+71
-83
@@ -128,6 +128,11 @@ async function extractEpisodes(movieUrl) {
|
||||
}
|
||||
|
||||
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 {
|
||||
const eidMatch = url.match(/eid=([^&]+)/);
|
||||
if (eidMatch && eidMatch[1]) {
|
||||
@@ -138,8 +143,7 @@ async function extractStreamUrl(url) {
|
||||
url = url.replace('&_=ENCRYPT_ME', `&_=${encryptedToken}`);
|
||||
}
|
||||
|
||||
const fetchUrl = `${url}`;
|
||||
const response = await fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(fetchUrl));
|
||||
const response = await fetchv2("https://deno-proxies-sznvnpnxwhbv.deno.dev/?url=" + encodeURIComponent(url));
|
||||
const responseData = await response.json();
|
||||
const cleanedHtml = cleanJsonHtml(responseData.result);
|
||||
|
||||
@@ -153,12 +157,8 @@ async function extractStreamUrl(url) {
|
||||
|
||||
const serverId = server1Match[1];
|
||||
|
||||
const tokenPromises = [
|
||||
fetchv2(`https://enc-dec.app/api/enc-movies-flix?text=${encodeURIComponent(serverId)}`)
|
||||
];
|
||||
|
||||
const tokenResponses = await Promise.all(tokenPromises);
|
||||
const tokenData = await tokenResponses[0].json();
|
||||
const tokenData = await fetchv2(`https://enc-dec.app/api/enc-movies-flix?text=${encodeURIComponent(serverId)}`)
|
||||
.then(res => res.json());
|
||||
const token = tokenData.result;
|
||||
|
||||
if (!token) {
|
||||
@@ -174,41 +174,35 @@ async function extractStreamUrl(url) {
|
||||
console.log("Stream result not found");
|
||||
return "error";
|
||||
}
|
||||
|
||||
const decryptPromises = [
|
||||
fetchv2("https://enc-dec.app/api/dec-movies-flix", { "Content-Type": "application/json" }, "POST", JSON.stringify({ text: streamData.result }))
|
||||
];
|
||||
|
||||
const decryptResponses = await Promise.all(decryptPromises);
|
||||
const decryptData = await decryptResponses[0].json();
|
||||
const decryptedUrl = decryptData.result.url;
|
||||
|
||||
const subListEncoded = decryptedUrl.split("sub.list=")[1]?.split("&")[0];
|
||||
let subtitles = "N/A";
|
||||
// Fix: no encodeURIComponent, pass headers with browser UA
|
||||
const decryptData = await fetchv2(
|
||||
`https://enc-dec.app/api/dec-movies-flix?text=${streamData.result}`,
|
||||
headers
|
||||
).then(res => res.json());
|
||||
|
||||
if (subListEncoded) {
|
||||
try {
|
||||
const subListUrl = decodeURIComponent(subListEncoded);
|
||||
const subResponse = await fetchv2(subListUrl);
|
||||
subtitles = await subResponse.json();
|
||||
} catch {
|
||||
subtitles = "N/A";
|
||||
}
|
||||
}
|
||||
|
||||
const englishSubUrl = Array.isArray(subtitles)
|
||||
? subtitles.find(sub => sub.label === "English")?.file.replace(/\\\//g, "/")
|
||||
: "N/A";
|
||||
const decryptedUrl = decryptData.result?.url;
|
||||
|
||||
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 subListEncoded = decryptedUrl.split("sub.list=")[1]?.split("&")[0];
|
||||
let subtitles = "N/A";
|
||||
if (subListEncoded) {
|
||||
try {
|
||||
const subListUrl = decodeURIComponent(subListEncoded);
|
||||
const subResponse = await fetchv2(subListUrl);
|
||||
subtitles = await subResponse.json();
|
||||
} catch {
|
||||
subtitles = "N/A";
|
||||
}
|
||||
}
|
||||
|
||||
const englishSubUrl = Array.isArray(subtitles)
|
||||
? subtitles.find(sub => sub.label === "English")?.file.replace(/\\\//g, "/")
|
||||
: "N/A";
|
||||
|
||||
const mediaResponse = await fetchv2(decryptedUrl.replace("/e/", "/media/"), headers);
|
||||
const mediaJson = await mediaResponse.json();
|
||||
@@ -219,59 +213,53 @@ async function extractStreamUrl(url) {
|
||||
return "error";
|
||||
}
|
||||
|
||||
const postData = {
|
||||
"text": result,
|
||||
"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 finalPromises = [
|
||||
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 finalJson = await fetchv2(
|
||||
"https://enc-dec.app/api/dec-mega",
|
||||
{ "Content-Type": "application/json" },
|
||||
"POST",
|
||||
JSON.stringify({ text: result, agent: headers["User-Agent"] })
|
||||
).then(res => res.json());
|
||||
|
||||
const m3u8Link = finalJson?.result?.sources?.[0]?.file;
|
||||
|
||||
const m3u8Response = await fetchv2(m3u8Link);
|
||||
const m3u8Text = await m3u8Response.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) {
|
||||
const streamPath = lines[i + 1].trim();
|
||||
const streamUrl = baseUrl + streamPath;
|
||||
|
||||
streams.push({
|
||||
title: quality,
|
||||
streamUrl: streamUrl
|
||||
});
|
||||
}
|
||||
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) {
|
||||
const streamPath = lines[i + 1].trim();
|
||||
streams.push({
|
||||
title: quality,
|
||||
streamUrl: baseUrl + streamPath
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const returnValue = {
|
||||
streams: streams,
|
||||
subtitle: englishSubUrl !== "N/A" ? englishSubUrl : ""
|
||||
};
|
||||
console.log("RETURN: " + JSON.stringify(returnValue));
|
||||
return JSON.stringify(returnValue);
|
||||
|
||||
const returnValue = {
|
||||
streams: streams,
|
||||
subtitle: englishSubUrl !== "N/A" ? englishSubUrl : ""
|
||||
};
|
||||
console.log("RETURN: " + JSON.stringify(returnValue));
|
||||
return JSON.stringify(returnValue);
|
||||
} catch (error) {
|
||||
console.log("Fetch error:"+ error);
|
||||
console.log("Fetch error:" + error);
|
||||
return "https://error.org";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"name": "50/50",
|
||||
"icon": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ3122kQwublLkZ6rf1fEpUP79BxZOFmH9BSA&s"
|
||||
},
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"language": "English",
|
||||
"streamType": "HLS",
|
||||
"quality": "1080p",
|
||||
|
||||
Reference in New Issue
Block a user