async function searchResults(keyword) { const results = []; const response = await soraFetch(`https://www.animetoast.cc/?s=${keyword}`); const html = await response.text(); const regex = /]*title="([^"]+)"[^>]*>[\s\S]*?]*src="([^"]+)"[^>]*>[\s\S]*?<\/a>/g; let match; while ((match = regex.exec(html)) !== null) { let title = match[2].trim(); // if title contains "Ger Dub" or "Ger Sub" or "Eng Dub" or "Eng Sub", remove it and then place it at the beginning of the title if (title.includes("Ger Dub") || title.includes("Ger Sub") || title.includes("Eng Dub") || title.includes("Eng Sub")) { let lang = ''; if (title.includes("Ger Dub")) { lang = 'DUB'; } else if (title.includes("Ger Sub")) { lang = 'SUB'; } else if (title.includes("Eng Dub")) { lang = 'EN-DUB'; } else if (title.includes("Eng Sub")) { lang = 'EN-SUB'; } title = `${lang} ${title.replace(/(Ger Dub|Ger Sub|Eng Dub|Eng Sub)/, '').trim()}`; } results.push({ title: title, image: match[3].trim(), href: match[1].trim() }); } return JSON.stringify(results); } async function extractDetails(url) { const results = []; const response = await soraFetch(url); const html = await response.text(); let description = ''; const descriptionRegex = /

(?:]*>)?(.*?)<\/p>/s; const descriptionMatch = html.match(descriptionRegex); if (descriptionMatch && descriptionMatch[1]) { description = descriptionMatch[1].trim(); } results.push({ description: description, aliases: 'N/A', airdate: 'N/A' }); return JSON.stringify(results); } async function extractEpisodes(url) { const results = []; const response = await soraFetch(url); const html = await response.text(); let episodes = []; try { episodes = await extractEpisodeHosts(html, url); } catch (error) { sendLog("Error extracting episodes: " + error.message); return JSON.stringify([{ error: "Failed to extract episodes" }]); } sendLog(JSON.stringify(episodes)); if (episodes.length === 0) { sendLog("No episodes found"); return JSON.stringify([{ error: "No episodes found" }]); } let count = 0; for (const episodeUrl of episodes) { count++; results.push({ href: episodeUrl, number: count }); } sendLog("Extracted " + count + " episodes"); return JSON.stringify(results); } async function extractEpisodeHosts(html, url) { //

  • // Voe //
  • const results = {} const tabRegex = /]*data-toggle=["']tab["'][^>]*href=["']([^"']+)["'][^>]*>(.*?)<\/a>/g; const tabMatches = [...html.matchAll(tabRegex)]; sendLog("Tab matches: " + JSON.stringify(tabMatches)); if (tabMatches.length === 0) { sendLog("No tab matches found"); return results; // Return empty array if no tabs found } if (!tabMatches[0]) { sendLog("No tab match found"); return results; // Return empty array if no tab match found } for (const match of tabMatches) { const tabHref = match[1].trim(); sendLog("Tab Href: " + tabHref); const tabId = tabHref.startsWith('#') ? tabHref.substring(1) : tabHref; sendLog("Tab ID: " + tabId); const provider = match[2].trim().toLowerCase(); // The issue is here - the regex is capturing only the number part after "multi_link_tab" // but we need to match the full ID const divRegex = /