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 = []; try { const response = await fetchv2("https://www.faselhds.xyz/?s=" + encodeURIComponent(keyword)); const html = await response.text(); const regex = /
([\s\S]*?)<\/p>/.exec(html);
const description = match ? match[1].trim() : "N/A";
return JSON.stringify([{
description: decodeHtmlEntities(description),
aliases: "N/A",
airdate: "N/A"
}]);
} catch (err) {
return JSON.stringify([{
description: "Error",
aliases: "Error",
airdate: "Error"
}]);
}
}
async function extractEpisodes(url) {
const baseUrl = "https://www.faselhds.xyz";
const allEpisodes = [];
function extractEpisodesFromHtml(html) {
const episodes = [];
const regex = /]*>\s*الحلقة\s*(\d+)\s*<\/a>/g;
let match;
while ((match = regex.exec(html)) !== null) {
episodes.push({
href: match[1].trim(),
number: parseInt(match[2], 10),
});
}
return episodes;
}
try {
const response = await fetchv2(url);
const html = await response.text();
const seasonDivRegex = /