\s*
(.*?)<\/p>\s*<\/div>/s);
let description = "N/A";
if (match) {
const rawDescription = match[1];
description = rawDescription.replace(/<\/?span[^>]*>/g, '').trim();
description = description.replace(/\s+/g, ' ');
}
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 = [];
try {
const response = await fetchv2(url);
const html = await response.text();
const episodesListMatch = html.match(/
(\d+)<\/b>[\s\S]*?<\/a>[\s\S]*?<\/li>/g;
let match;
const episodes = [];
while ((match = episodeItemRegex.exec(episodesHTML)) !== null) {
const href = match[1].trim();
const episodeNumber = parseInt(match[2]);
episodes.push({
href: href,
number: episodeNumber
});
}
episodes.sort((a, b) => a.number - b.number);
results.push(...episodes);
if (results.length === 0) {
results.push({
href: url,
number: 1
});
}
return JSON.stringify(results);
} catch (err) {
return JSON.stringify([{
href: url,
number: 1
}]);
}
}
async function extractStreamUrl(url) {
try {
const response = await fetchv2(url);
const html = await response.text();
const match = html.match(/href="([^"]+)"[^>]*class="btton watch__btn"/);
console.log("Match found: " + match);
if (match) {
const extractedUrl = match[1].replace(/&/g, '&');
const headers = {
"Referer": "https://a.asd.homes/"
};
const extractedResponse = await fetchv2(extractedUrl, headers);
const extractedHtml = await extractedResponse.text();
console.log("Extracted HTML snippet:"+ extractedHtml);
const embedMatch = extractedHtml.match(/