function decodeHtmlEntities(text) {
return text
.replace(/’/g, "'")
.replace(/“/g, '"')
.replace(/”/g, '"')
.replace(/…/g, '...')
.replace(/&/g, '&')
.replace(/"/g, '"')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/(\d+);/g, (_, num) => String.fromCharCode(num));
}
async function searchResults(keyword) {
const results = [];
const regex = /
[\s\S]*?
]+src="([^"]+)"[^>]+title="([^"]+)"[^>]*>[\s\S]*?]+href="([^"]+)"[^>]*>/gi;
try {
const response = await fetchv2("https://www1.divxfilmeonline.net/?s=" + encodeURIComponent(keyword));
const html = await response.text();
regex.lastIndex = 0;
let match;
while ((match = regex.exec(html)) !== null) {
results.push({
image: match[1].trim(),
title: decodeHtmlEntities(match[2].trim()),
href: match[3].trim()
});
}
return JSON.stringify(results);
} catch (err) {
return JSON.stringify([{
title: "Error",
image: "Error",
href: "Error"
}]);
}
}
async function extractDetails(url) {
try {
return JSON.stringify([{
description: "Description not available",
aliases: "N/A",
airdate: "N/A"
}]);
} catch (err) {
return JSON.stringify([{
description: "Error",
aliases: "Error",
airdate: "Error"
}]);
}
}
async function extractEpisodes(url) {
try {
const response = await fetchv2(url);
const html = await response.text();
const filemoonMatch = /]*class="server server-active"[^>]*data-vs="([^"]*fastvid\.co[^"]*)"[^>]*>Filemoon/i.exec(html);
if (filemoonMatch) {
return JSON.stringify([{
href: filemoonMatch[1].trim(),
number: 1
}]);
} else {
throw new Error("Filemoon episode not found");
}
} catch (err) {
return JSON.stringify([{
href: "Error",
number: "Error",
message: err.message
}]);
}
}
async function extractStreamUrl(url) {
try {
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://www1.divxfilmeonline.net/"
};
const response = await fetchv2(url, headers);
const html = await response.text();
const iframeMatch = /