<\/div>\s*<\/div>/;
const filmListMatch = html.match(filmListRegex);
if (!filmListMatch) {
return JSON.stringify(results);
}
const filmListContent = filmListMatch[1];
const itemRegex = /
[\s\S]*?<\/div>[\s]*<\/div>/g;
const items = filmListContent.match(itemRegex) || [];
items.forEach((itemHtml) => {
const imgMatch = itemHtml.match(/src="([^"]+)"/);
let imageUrl = imgMatch ? imgMatch[1] : "";
const titleMatch = itemHtml.match(/class="name">([^<]+));
const title = titleMatch ? titleMatch[1] : "";
const hrefMatch = itemHtml.match(/href="([^"]+)"/);
let href = hrefMatch ? hrefMatch[1] : "";
if (imageUrl && title && href) {
if (!imageUrl.startsWith("https")) {
if (imageUrl.startsWith("/")) {
imageUrl = baseUrl + imageUrl;
} else {
imageUrl = baseUrl + "/" + href;
}
}
if (!href.startsWith("https")) {
if (href.startsWith("/")) {
href = baseUrl + href;
} else {
href = baseUrl + "/" + href;
}
}
results.push({
title: title.trim(),
image: imageUrl,
href: href,
});
}
});
console.log(JSON.stringify(results));
return JSON.stringify(results);
} catch (error) {
console.log("Search error:", error);
return JSON.stringify([]);
}
}
async function extractDetails(url) {
try {
const response = await soraFetch(url);
const html = await response.text();
const details = [];
const descriptionMatch = html.match(/
([\s\S]*?)<\/div>/);
let description = descriptionMatch ? descriptionMatch[1] : "";
const aliasesMatch = html.match(/