async function searchResults(keyword) { const postData = `op=title_search&q=${encodeURIComponent(keyword)}`; const headers = await getDefaultHeaders(); const results = []; try { const response = await fetchv2("https://beta.otaku-streamers.com/a.php", headers, "POST", postData); const data = await response.json(); if (data && data.content) { data.content.forEach(item => { results.push({ title: item.title, image: item.cover, href: item.url }); }); } return JSON.stringify(results); } catch (err) { return JSON.stringify([{ title: "Error", image: "Error", href: "Error" }]); } } async function extractDetails(url) { const headers = await getDefaultHeaders(); try { const response = await fetchv2(url, headers); const html = await response.text(); const descriptionMatch = html.match(/
([\s\S]*?)<\/p>/i);
const description = descriptionMatch ? descriptionMatch[1].replace(/
/gi, "\n").replace(/<\/?[^>]+(>|$)/g, "").trim() : "N/A";
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 headers = await getDefaultHeaders();
const results = [];
try {
const response = await fetchv2(url, headers);
const html = await response.text();
const regex = //g;
let match;
while ((match = regex.exec(html)) !== null) {
results.push({
href: match[1].trim(),
number: parseInt(match[2], 10)
});
}
results.reverse();
return JSON.stringify(results);
} catch (err) {
return JSON.stringify([{
href: "Error",
number: "Error"
}]);
}
}
async function extractStreamUrl(url) {
const headers = await getDefaultHeaders();
try {
const response = await fetchv2(url, headers);
const html = await response.text();
const streamMatch = html.match(/