async function searchResults(keyword) { const results = []; try { const response = await fetchv2("https://animeq.blog/?s=" + encodeURIComponent(keyword)); const html = await response.text(); const regex = /
[\s\S]*?]*>\s*]*alt="([^"]+)"/g; let match; while ((match = regex.exec(html)) !== null) { results.push({ href: match[1].trim(), image: match[2].trim(), title: cleanHtmlSymbols(match[3].trim()) }); } return JSON.stringify(results); } catch (err) { return JSON.stringify([{ title: "Error", image: "Error", href: "Error" }]); } } async function extractDetails(url) { try { const response = await fetchv2(url); const html = await response.text(); const regex = /

\s*Sinopse\s*:\s*([\s\S]*?)<\/p>/i; const match = regex.exec(html); const description = match ? match[1].trim() : "fuck off you don't need a description"; 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 = []; const regex = /

]*>\d+\s*-\s*(\d+)<\/div>[\s\S]*?]*>/g; try { const response = await fetchv2(url); const html = await response.text(); let match; while ((match = regex.exec(html)) !== null) { const episodeNumber = parseInt(match[1], 10); const href = match[2].trim(); results.push({ href: "episode: " + href, number: episodeNumber }); } if (results.length === 0) { results.push({ href: "movie: " + url, number: 1 }); } return JSON.stringify(results); } catch (err) { return JSON.stringify([{ href: "Error", number: "Error" }]); } } async function extractStreamUrl(url) { try { let endpointType; if (url.startsWith("movie: ")) { url = url.replace("movie: ", ""); endpointType = "movie"; } else if (url.startsWith("episode: ")) { url = url.replace("episode: ", ""); endpointType = "tv"; } else { return "ERROR"; } const response = await fetchv2(url); const html = await response.text(); const idMatch = html.match(/