function cleanTitle(title) { return title .replace(/’/g, "'") .replace(/–/g, "-") .replace(/[0-9]+;/g, ""); } async function searchResults(keyword) { const results = []; try { const response = await fetchv2("https://wwv.monoschinos2.net/animes?buscar=" + encodeURIComponent(keyword)); const html = await response.text(); const regex = /
(.*?)<\/p>/s); const description = match ? match[1].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 results = []; try { const parts = url.split('/'); const u = parts[parts.length - 1] || parts[parts.length - 2]; const initialResponse = await fetchv2(url); const html = await initialResponse.text(); const iMatch = html.match(/data-i="(\d+)"/); const i = iMatch ? iMatch[1] : null; console.log("Slug:" + u); console.log("Data-i:" + i); if (!i) throw new Error("data-i not found"); let page = 1; let episodeCount = 0; while (true) { const formData = `acc=episodes&i=${i}&u=${u}&p=${page}`; console.log("Form Data: " + formData); const headers = { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "X-Requested-With": "XMLHttpRequest", "Origin": "https://wwv.monoschinos2.net", "Referer": url }; const response = await fetchv2("https://wwv.monoschinos2.net/ajax_pagination", headers, "POST", formData); const pageHtml = await response.text(); console.log(pageHtml); if (!pageHtml.trim()) break; const regex = / { ep.number = total - index; }); return JSON.stringify(results.reverse()); } catch (err) { return JSON.stringify({ slug: "Error", dataI: "Error", episodes: [{ href: "Error", number: "Error" }] }); } } async function extractStreamUrl(url) { try { const response = await fetchv2(url); const html = await response.text(); const match = html.match(/href="(https:\/\/(?:filemoon\.sx|[^"]+\.to)\/d\/[^"]+)"/); if (!match) return "https://error.org/"; const filemoonUrl = match[1].replace("/d/", "/e/"); const filemoonResponse = await fetchv2(filemoonUrl); const filemoonHtml = await filemoonResponse.text(); let streamUrl = null; try { streamUrl = await filemoonExtractor(filemoonHtml, filemoonUrl); } catch (error) { console.log("filemoon HD extraction error:" + error); } console.log("filemoon Stream URL: " + streamUrl); if (streamUrl && streamUrl !== false && streamUrl !== null) { return streamUrl; } console.log("No stream URL found"); return null; } catch (error) { console.log("Fetch error:", error); return null; } } /* SCHEME START */ /* {REQUIRED PLUGINS: unbaser} */ /** * @name filemoonExtractor * @author Cufiy - Inspired by Churly */ async function filemoonExtractor(html, url = null) { // check if contains iframe, if does, extract the src and get the url const regex = /