fix
Fetch and Save Remote Content / fetch (push) Successful in 34s
Sync Versions to index.json / sync-versions (push) Successful in 47s

This commit is contained in:
aka paul
2026-04-23 22:09:43 +02:00
parent 84a8284a50
commit c10e3b71b7
2 changed files with 72 additions and 84 deletions
+71 -83
View File
@@ -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) {
@@ -174,41 +174,35 @@ async function extractStreamUrl(url) {
console.log("Stream result not found"); console.log("Stream result not found");
return "error"; 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]; // Fix: no encodeURIComponent, pass headers with browser UA
let subtitles = "N/A"; const decryptData = await fetchv2(
`https://enc-dec.app/api/dec-movies-flix?text=${streamData.result}`,
headers
).then(res => res.json());
if (subListEncoded) { const decryptedUrl = decryptData.result?.url;
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";
if (!decryptedUrl) { if (!decryptedUrl) {
console.log("Decryption failed"); console.log("Decryption failed");
return "error"; return "error";
} }
const headers = { const subListEncoded = decryptedUrl.split("sub.list=")[1]?.split("&")[0];
"Referer": "https://1movies.bz/", let subtitles = "N/A";
"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" 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 mediaResponse = await fetchv2(decryptedUrl.replace("/e/", "/media/"), headers);
const mediaJson = await mediaResponse.json(); const mediaJson = await mediaResponse.json();
@@ -219,59 +213,53 @@ 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;
const m3u8Response = await fetchv2(m3u8Link); const m3u8Response = await fetchv2(m3u8Link);
const m3u8Text = await m3u8Response.text(); const m3u8Text = await m3u8Response.text();
const baseUrl = m3u8Link.substring(0, m3u8Link.lastIndexOf('/') + 1); const baseUrl = m3u8Link.substring(0, m3u8Link.lastIndexOf('/') + 1);
const streams = []; const streams = [];
const lines = m3u8Text.split('\n'); const lines = m3u8Text.split('\n');
for (let i = 0; i < lines.length; i++) { for (let i = 0; i < lines.length; i++) {
const line = lines[i].trim(); const line = lines[i].trim();
if (line.startsWith('#EXT-X-STREAM-INF:')) { if (line.startsWith('#EXT-X-STREAM-INF:')) {
const resolutionMatch = line.match(/RESOLUTION=(\d+x\d+)/); const resolutionMatch = line.match(/RESOLUTION=(\d+x\d+)/);
let quality = 'Unknown'; let quality = 'Unknown';
if (resolutionMatch) { if (resolutionMatch) {
const [width, height] = resolutionMatch[1].split('x'); const [width, height] = resolutionMatch[1].split('x');
quality = `${height}p`; quality = `${height}p`;
} }
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({
title: quality,
streams.push({ streamUrl: baseUrl + streamPath
title: quality, });
streamUrl: streamUrl
});
}
} }
} }
}
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) { } catch (error) {
console.log("Fetch error:"+ error); console.log("Fetch error:" + error);
return "https://error.org"; return "https://error.org";
} }
} }
+1 -1
View File
@@ -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",