update
This commit is contained in:
+65
-47
@@ -29,12 +29,17 @@ async function extractDetails(url) {
|
||||
try {
|
||||
const response = await fetchv2(url);
|
||||
const html = await response.text();
|
||||
const regex = /<div class="view-stocon"><div class="c" id="animeContents">([\s\S]*?)<\/div><\/div>/;
|
||||
const regex = /<div class="view-stocon"><div class="c"[^>]*>([\s\S]*?)<\/div>/;
|
||||
|
||||
let description = "N/A";
|
||||
const match = regex.exec(html);
|
||||
if (match) {
|
||||
description = match[1].replace(/<br>/g, "\n").replace(/ /g, " ").replace(/<[^>]*>/g, "").replace(/\n\n+/g, "\n").trim();
|
||||
description = match[1]
|
||||
.replace(/<br\s*\/?>/gi, "\n")
|
||||
.replace(/ /g, " ")
|
||||
.replace(/<[^>]*>/g, "")
|
||||
.replace(/\n\s*\n+/g, "\n")
|
||||
.trim();
|
||||
}
|
||||
|
||||
return JSON.stringify([{
|
||||
@@ -74,57 +79,70 @@ async function extractEpisodes(url) {
|
||||
}]);
|
||||
}
|
||||
}
|
||||
|
||||
async function extractStreamUrl(url) {
|
||||
try {
|
||||
const response = await fetchv2(url);
|
||||
const html = await response.text();
|
||||
const regex = /<input type="hidden" name="vurl" value="https:\/\/michealcdn\.com\/video\/([^"]+)"/;
|
||||
|
||||
const match = regex.exec(html);
|
||||
if (match) {
|
||||
try {
|
||||
const videoId = match[1];
|
||||
console.log("Video ID: " + videoId);
|
||||
const postData = "hash=" + videoId + "&r=https%3A%2F%2Fmm.viaproducciones.net%2F"
|
||||
const headers = {
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
};
|
||||
const response = await fetchv2("https://michealcdn.com/player/index.php?data=" + videoId + "&do=getVideo", headers, "POST", postData);
|
||||
const data = await response.json();
|
||||
console.log("Fetched video data: " + JSON.stringify(data));
|
||||
|
||||
const streamUrl = data.securedLink;
|
||||
return JSON.stringify({
|
||||
"streams": [
|
||||
{
|
||||
"title": "Stream 1",
|
||||
"streamUrl": streamUrl,
|
||||
"headers": {
|
||||
"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",
|
||||
"Accept": "*/*",
|
||||
"Accept-Language": "en-US,en;q=0.9",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Referer": "https://michealcdn.com/",
|
||||
"Origin": "https://michealcdn.com",
|
||||
"Sec-Fetch-Dest": "video",
|
||||
"Sec-Fetch-Mode": "cors",
|
||||
"Sec-Fetch-Site": "same-origin",
|
||||
"Range": "bytes=0-"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subtitle": ""
|
||||
});
|
||||
} catch (err) {
|
||||
console.log("Error fetching video URL:"+ err);
|
||||
}
|
||||
return JSON.stringify({"streams": [{"title": "Error", "streamUrl": "https://error.org/", "headers": {}}], "subtitle": ""});
|
||||
|
||||
const vMatch = html.match(/<input type="hidden" name="v" value="([^"]+)"/);
|
||||
if (!vMatch) {
|
||||
return JSON.stringify({ streams: [], subtitle: "" });
|
||||
}
|
||||
|
||||
return JSON.stringify({"streams": [{"title": "Error", "streamUrl": "https://error.org/", "headers": {}}], "subtitle": ""});
|
||||
const vValue = vMatch[1];
|
||||
const glamovUrl = `https://ani.glamov.com/tv-show.php?v=${vValue}`;
|
||||
|
||||
const glamovResponse = await fetchv2(glamovUrl);
|
||||
const glamovHtml = await glamovResponse.text();
|
||||
|
||||
const iframeMatch = glamovHtml.match(/<iframe src="([^"]+)"/);
|
||||
if (!iframeMatch) {
|
||||
return JSON.stringify({ streams: [], subtitle: "" });
|
||||
}
|
||||
|
||||
let iframeUrl = iframeMatch[1];
|
||||
if (iframeUrl.startsWith("//")) iframeUrl = "https:" + iframeUrl;
|
||||
|
||||
const videoIdMatch = iframeUrl.match(/\/video\/([^/?#]+)/);
|
||||
if (!videoIdMatch) {
|
||||
return JSON.stringify({ streams: [], subtitle: "" });
|
||||
}
|
||||
const videoId = videoIdMatch[1];
|
||||
|
||||
let iframeOrigin = "";
|
||||
const originMatch = iframeUrl.match(/^(https?:\/\/[^/]+)/);
|
||||
if (originMatch) {
|
||||
iframeOrigin = originMatch[1];
|
||||
} else {
|
||||
return JSON.stringify({ streams: [], subtitle: "" });
|
||||
}
|
||||
|
||||
const apiUrl = `${iframeOrigin}/player/index.php?data=${videoId}&do=getVideo`;
|
||||
|
||||
const postData = `hash=${videoId}&r=https%3A%2F%2Fani.glamov.com%2F`;
|
||||
const headers = {
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
};
|
||||
|
||||
const apiResponse = await fetchv2(apiUrl, headers, "POST", postData);
|
||||
const apiJson = await apiResponse.json();
|
||||
|
||||
if (apiJson && apiJson.videoSource) {
|
||||
return JSON.stringify({
|
||||
streams: [{
|
||||
title: "Stream 1",
|
||||
streamUrl: apiJson.videoSource.replace(/\\\//g, "/"),
|
||||
headers: {}
|
||||
}],
|
||||
subtitle: ""
|
||||
});
|
||||
}
|
||||
|
||||
return JSON.stringify({ streams: [], subtitle: "" });
|
||||
|
||||
} catch (err) {
|
||||
return JSON.stringify({"streams": [{"title": "Error", "streamUrl": "https://error.org/", "headers": {}}], "subtitle": ""});
|
||||
return JSON.stringify({ streams: [], subtitle: "" });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user