update
This commit is contained in:
+52
-54
@@ -71,9 +71,17 @@ async function extractEpisodes(url) {
|
||||
const movieRegex = /<a[^>]+href=["']([^"']+)["'][^>]+class=["'][^"']*link-btn link-show[^"']*["'][^>]*>/i;
|
||||
const movieMatch = movieRegex.exec(html);
|
||||
|
||||
const buildHref = (extractedHref) => {
|
||||
const watchMatch = extractedHref.match(/\/watch\/(\d+)/i);
|
||||
if (watchMatch) {
|
||||
return url.replace(/\/(movie|series|episode)\//i, `/watch/${watchMatch[1]}/`);
|
||||
}
|
||||
return extractedHref;
|
||||
};
|
||||
|
||||
if (movieMatch && movieMatch[1]) {
|
||||
episodes.push({
|
||||
href: movieMatch[1],
|
||||
href: buildHref(movieMatch[1]),
|
||||
number: 1
|
||||
});
|
||||
} else {
|
||||
@@ -86,7 +94,7 @@ async function extractEpisodes(url) {
|
||||
const hrefMatch = block.match(/href=["']([^"']+)["']/);
|
||||
if (hrefMatch) {
|
||||
episodes.push({
|
||||
href: hrefMatch[1],
|
||||
href: buildHref(hrefMatch[1]),
|
||||
number: index + 1
|
||||
});
|
||||
}
|
||||
@@ -99,67 +107,57 @@ async function extractEpisodes(url) {
|
||||
}
|
||||
|
||||
async function extractStreamUrl(url) {
|
||||
let stream = null;
|
||||
const response = await fetchv2(url);
|
||||
const html = await response.text();
|
||||
const urlMatch = html.match(/<meta property="og:url" content="([^"]+)"/);
|
||||
const isEpisode = urlMatch && urlMatch[1] && urlMatch[1].includes("/episode/");
|
||||
const streams = [];
|
||||
try {
|
||||
let streamPageUrl = url;
|
||||
|
||||
if (isEpisode) {
|
||||
const linkBtnMatches = html.match(/<a[^>]*class="link-btn link-show[^"]*"[^>]*>[\s\S]*?<\/a>/g);
|
||||
let match = null;
|
||||
|
||||
if (linkBtnMatches && linkBtnMatches.length > 0) {
|
||||
const hrefMatch = linkBtnMatches[0].match(/href="([^"]+)"/);
|
||||
if (hrefMatch && hrefMatch[1]) {
|
||||
match = [null, hrefMatch[1]];
|
||||
}
|
||||
}
|
||||
|
||||
if (match && match[1]) {
|
||||
try {
|
||||
const shortnerResponse = await fetch(match[1]);
|
||||
const shortnerHtml = await shortnerResponse;
|
||||
|
||||
const finalMatch = shortnerHtml.match(/<div class="d-none d-md-block">\s*<a href="([^"]+)"/);
|
||||
|
||||
if (finalMatch && finalMatch[1]) {
|
||||
let finalUrl = finalMatch[1].replace("two.akw.cam", "ak.sv");
|
||||
|
||||
const lastResponse = await fetch(finalUrl);
|
||||
const lastHtml = await lastResponse;
|
||||
const videoMatch = lastHtml.match(/<source\s+src="([^"]+)"\s+type="video\/mp4"/);
|
||||
|
||||
if (videoMatch && videoMatch[1]) {
|
||||
stream = videoMatch[1];
|
||||
}
|
||||
if (url.includes("/episode/")) {
|
||||
const epResponse = await fetchv2(url);
|
||||
const epHtml = await epResponse.text();
|
||||
|
||||
const linkRegex = /<a[^>]+href=["']([^"']+)["'][^>]+class=["'][^"']*link-btn link-show[^"']*["'][^>]*>/i;
|
||||
const linkMatch = linkRegex.exec(epHtml);
|
||||
|
||||
if (linkMatch && linkMatch[1]) {
|
||||
const watchMatch = linkMatch[1].match(/\/watch\/(\d+)/i);
|
||||
if (watchMatch) {
|
||||
streamPageUrl = url.replace(/\/(episode)\//i, `/watch/${watchMatch[1]}/`);
|
||||
} else {
|
||||
streamPageUrl = linkMatch[1];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error fetching shortener URL:", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const finalMatch = html.match(/<div class="d-none d-md-block">\s*<a href="([^"]+)"/);
|
||||
if (finalMatch && finalMatch[1]) {
|
||||
try {
|
||||
let finalUrl = finalMatch[1].replace("two.akw.cam", "ak.sv");
|
||||
const lastResponse = await fetch(finalUrl);
|
||||
const lastHtml = await lastResponse;
|
||||
const videoMatch = lastHtml.match(/<source\s+src="([^"]+)"\s+type="video\/mp4"/);
|
||||
|
||||
if (videoMatch && videoMatch[1]) {
|
||||
stream = videoMatch[1];
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error fetching final URL:", error);
|
||||
return null;
|
||||
const response = await fetchv2(streamPageUrl);
|
||||
const html = await response.text();
|
||||
|
||||
const sourceTagRegex = /<source[^>]+>/gi;
|
||||
let match;
|
||||
|
||||
while ((match = sourceTagRegex.exec(html)) !== null) {
|
||||
const sourceHtml = match[0];
|
||||
const srcMatch = sourceHtml.match(/src=["']([^"']+)["']/i);
|
||||
const sizeMatch = sourceHtml.match(/size=["']([^"']+)["']/i);
|
||||
|
||||
if (srcMatch) {
|
||||
streams.push({
|
||||
title: sizeMatch ? sizeMatch[1] : "Default",
|
||||
streamUrl: srcMatch[1],
|
||||
headers: {}
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error fetching stream:", error);
|
||||
}
|
||||
|
||||
console.log(stream);
|
||||
return stream;
|
||||
const result = {
|
||||
streams: streams,
|
||||
subtitle: ""
|
||||
};
|
||||
|
||||
console.log(JSON.stringify(result));
|
||||
return JSON.stringify(result);
|
||||
}
|
||||
|
||||
function decodeHTMLEntities(text) {
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
"name": "50/50",
|
||||
"icon": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ3122kQwublLkZ6rf1fEpUP79BxZOFmH9BSA&s"
|
||||
},
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.6",
|
||||
"language": "Arabic (SUB)",
|
||||
"streamType": "MP4",
|
||||
"quality": "1080p",
|
||||
|
||||
Reference in New Issue
Block a user