]*>[\s\S]*?([\s\S]*?)<\/h5>[\s\S]*?
]+src="([^"]+)"/g;
let match;
while ((match = regex.exec(containerHtml)) !== null) {
results.push({
title: match[2].trim(),
image: match[3].trim(),
href: match[1].trim()
});
}
return JSON.stringify(results);
} catch (err) {
return JSON.stringify([{
title: "Error",
image: "Error",
href: "Error"
}]);
}
}
async function extractDetails(url) {
try {
const response = await fetchv2(url);
const html = await response.text();
const titleMatch = html.match(/\s*([\s\S]*?)\s*<\/h2>/);
const descriptionMatch = html.match(/
([\s\S]*?)<\/p>/);
const description = descriptionMatch ? descriptionMatch[1].trim() : "N/A";
const title = titleMatch ? titleMatch[1].trim() : "N/A";
return JSON.stringify([{
description: description,
aliases: title,
airdate: "N/A"
}]);
} catch (err) {
return JSON.stringify([{
description: "Error",
aliases: "Error",
airdate: "Error"
}]);
}
}
async function extractEpisodes(url) {
const results = [];
try {
const response = await fetchv2(url);
const html = await response.text();
const listMatch = html.match(/
([\s\S]*?)<\/div>\s*<\/div>/);
if (!listMatch) return JSON.stringify([]);
const listHtml = listMatch[1];
const regex = /
[\s\S]*?Episodio (\d+)<\/b>/g;
let match;
while ((match = regex.exec(listHtml)) !== null) {
results.push({
href: match[1].trim(),
number: parseInt(match[2], 10)
});
}
return JSON.stringify(results);
} catch (err) {
return JSON.stringify([{ href: "Error", number: "Error" }]);
}
}
async function extractStreamUrl(url) {
try {
const response = await fetchv2(url);
const html = await response.text();
const match = html.match(/\["FM","(https:\\?\/\\?\/filemoon\.to\\?\/e\\?\/[^"]+)"/);
const filemoonLink = match[1].replace(/\\\//g, "/");
console.log(filemoonLink);
const response2 = await fetchv2(filemoonLink);
const html2 = await response2.text();
let streamUrl = null;
try {
streamUrl = await filemoonExtractor(html2, filemoonLink);
} catch (error) {
console.log("filemoon HD extraction error:" + error);
}
console.log("filemoon Stream URL: " + streamUrl);
if (streamUrl && streamUrl !== false && streamUrl !== null) {
return streamUrl;
}
console.log("No stream URL found");
return null;
} catch (error) {
console.log("Fetch error:", error);
return null;
}
}
/* SCHEME START */
/* {REQUIRED PLUGINS: unbaser} */
/**
* @name filemoonExtractor
* @author Cufiy - Inspired by Churly
*/
async function filemoonExtractor(html, url = null) {
// check if contains iframe, if does, extract the src and get the url
const regex = /