]*>\s*
([\s\S]*?)<\/p>/i.exec(html);
}
if (!match) {
match = /
]*>[\s\S]*?
[\s\S]*?<\/h4>\s*
([\s\S]*?)<\/p>/i.exec(html);
}
const description = match ? match[1].trim() : "fuck off you don't need a description";
return JSON.stringify([{
description: description,
aliases: "N/A",
airdate: "N/A"
}]);
} catch (err) {
return JSON.stringify([{
description: "Error",
aliases: "Error",
airdate: "Error"
}]);
}
}
async function extractEpisodes(url) {
const results = [];
const regex = /
]*>\d+\s*-\s*(\d+)<\/div>[\s\S]*?
]*>/g;
try {
const response = await fetchv2(url);
const html = await response.text();
let match;
while ((match = regex.exec(html)) !== null) {
const episodeNumber = parseInt(match[1], 10);
const href = match[2].trim();
results.push({
href: "episode: " + href,
number: episodeNumber
});
}
if (results.length === 0) {
results.push({
href: "movie: " + url,
number: 1
});
}
return JSON.stringify(results);
} catch (err) {
return JSON.stringify([{
href: "Error",
number: "Error"
}]);
}
}
async function extractStreamUrl(url) {
try {
let endpointType;
if (url.startsWith("movie: ")) {
url = url.replace("movie: ", "");
endpointType = "movie";
} else if (url.startsWith("episode: ")) {
url = url.replace("episode: ", "");
endpointType = "tv";
} else {
return "ERROR";
}
const headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3",
"Referer": "https://flixlatam.com/"
};
const response = await fetchv2(url, headers);
const html = await response.text();
const idMatch = html.match(/')
.replace(/\\u0026/g, '&');
dataLink = JSON.parse(dataLinkStr);
} catch (e) {
console.error( e);
return "PARSE ERROR";
}
const defaultLang = dataLink[0];
const filemoonEmbed = defaultLang.sortedEmbeds.find(embed => embed.servername === "filemoon");
const SECRET_KEY = "Ak7qrvvH4WKYxV2OgaeHAEg2a5eh16vE";
const decryptedUrl = decryptLink(filemoonEmbed.link, SECRET_KEY);
console.log( decryptedUrl);
const filemoonResponse = await fetchv2(decryptedUrl);
const filemoonHtml = await filemoonResponse.text();
let streamUrl = null;
try {
streamUrl = await filemoonExtractor(filemoonHtml, decryptedUrl);
} 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 = /