update
This commit is contained in:
+71
-21
@@ -56,7 +56,7 @@ async function extractEpisodes(url) {
|
||||
while ((match = regex.exec(html)) !== null) {
|
||||
results.push({
|
||||
href: match[1].trim(),
|
||||
number: parseInt(match[2], 10)
|
||||
number: parseFloat(match[2])
|
||||
});
|
||||
}
|
||||
results.reverse();
|
||||
@@ -65,28 +65,78 @@ async function extractEpisodes(url) {
|
||||
|
||||
|
||||
async function extractStreamUrl(url) {
|
||||
const response = await fetchv2(url);
|
||||
const html = await response.text();
|
||||
try {
|
||||
const response = await fetchv2(url);
|
||||
const html = await response.text();
|
||||
const streams = [];
|
||||
|
||||
const optionRegex = /<option value="([^"]+)"[^>]*>\s*([^<]*Omega[^<]*)\s*<\/option>/gi;
|
||||
|
||||
let optionMatch;
|
||||
while ((optionMatch = optionRegex.exec(html)) !== null) {
|
||||
const base64Value = optionMatch[1];
|
||||
const label = optionMatch[2].trim();
|
||||
|
||||
if (!base64Value) continue;
|
||||
|
||||
const regexSub = /<option value="([^"]+)"[^>]*>\s*SUB - Omega\s*<\/option>/;
|
||||
const regexFallback = /<option value="([^"]+)"[^>]*>\s*Omega\s*<\/option>/;
|
||||
const anotherFallbackDawggggWhatsWrongWithTHisWebsite = /<option value="([^"]+)"[^>]*>\s*SUB v2 - Omega\s*<\/option>/;
|
||||
try {
|
||||
const decodedHtml = atob(base64Value);
|
||||
const iframeMatch = decodedHtml.match(/<iframe[^>]+src=["']([^"']+)["']/i);
|
||||
|
||||
if (iframeMatch) {
|
||||
let iframeUrl = iframeMatch[1];
|
||||
if (iframeUrl.startsWith("//")) iframeUrl = "https:" + iframeUrl;
|
||||
|
||||
const responseTwo = await fetchv2(iframeUrl);
|
||||
const htmlTwo = await responseTwo.text();
|
||||
|
||||
let match = html.match(regexSub) || html.match(regexFallback) || html.match(anotherFallbackDawggggWhatsWrongWithTHisWebsite);
|
||||
if (!match) return null;
|
||||
const m3u8Match = htmlTwo.match(/sources\s*:\s*\[\s*\{\s*file\s*:\s*['"]([^'"]+master\.m3u8[^'"]*)['"]/i) ||
|
||||
htmlTwo.match(/file\s*:\s*['"]([^'"]+\.m3u8[^'"]*)['"]/i);
|
||||
|
||||
if (m3u8Match) {
|
||||
streams.push({
|
||||
title: label,
|
||||
streamUrl: m3u8Match[1],
|
||||
headers: {
|
||||
"Referer": "https://vidmoly.biz/",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (innerErr) {
|
||||
}
|
||||
}
|
||||
|
||||
const decodedHtml = atob(match[1]); // Decode base64
|
||||
const iframeMatch = decodedHtml.match(/<iframe\s+src="([^"]+)"/);
|
||||
return JSON.stringify({
|
||||
streams: streams,
|
||||
subtitle: ""
|
||||
});
|
||||
} catch (err) {
|
||||
return JSON.stringify({
|
||||
streams: [],
|
||||
subtitle: ""
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!iframeMatch) return null;
|
||||
|
||||
const streamUrl = iframeMatch[1].startsWith("//") ? "https:" + iframeMatch[1] : iframeMatch[1];
|
||||
|
||||
const responseTwo = await fetchv2(streamUrl);
|
||||
const htmlTwo = await responseTwo.text();
|
||||
|
||||
const m3u8Match = htmlTwo.match(/sources:\s*\[\{file:"([^"]+\.m3u8)"/);
|
||||
console.error(m3u8Match ? m3u8Match[1] : null);
|
||||
return m3u8Match ? m3u8Match[1] : null;
|
||||
}
|
||||
function atob(input) {
|
||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||
let str = '';
|
||||
let buffer = 0;
|
||||
let bits = 0;
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
const char = input.charAt(i);
|
||||
if (char === '=') break;
|
||||
const index = chars.indexOf(char);
|
||||
if (index === -1) continue;
|
||||
buffer = (buffer << 6) | index;
|
||||
bits += 6;
|
||||
if (bits >= 8) {
|
||||
bits -= 8;
|
||||
str += String.fromCharCode((buffer >> bits) & 0xFF);
|
||||
buffer &= (1 << bits) - 1;
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"name": "50/50",
|
||||
"icon": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ3122kQwublLkZ6rf1fEpUP79BxZOFmH9BSA&s"
|
||||
},
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"language": "English (SUB/DUB)",
|
||||
"streamType": "HLS",
|
||||
"quality": "1080p",
|
||||
|
||||
Reference in New Issue
Block a user