async function searchResults(keyword) { const results = []; try { const response = await fetchv2("https://watchanimeworld.in/?s=" + encodeURIComponent(keyword)); const html = await response.text(); const regex = /
(.*?)<\/p>/s; const match = regex.exec(html); 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) { try { const response = await fetchv2(url); const html = await response.text(); const postMatch = html.match(/data-post="(\d+)"/); const postId = postMatch ? postMatch[1] : null; const seasonMatches = [...html.matchAll(/data-season="(\d+)"/g)]; const seasons = seasonMatches.map(m => parseInt(m[1], 10)); if (!postId || seasons.length === 0) { const metaMatch = html.match(/ { const body = `action=action_select_season&season=${season}&post=${postId}`; const seasonUrl = `https://passthrough-worker.simplepostrequest.workers.dev/?url=${encodeURIComponent("https://watchanimeworld.in/wp-admin/admin-ajax.php")}&type=formdata&body=${encodeURIComponent(body)}`; return fetchv2(seasonUrl) .then(res => res.text()) .then(seasonHtml => { const regex = /.*?<\/span>[\s\S]*?<\/a>/g; let match, episodeCount = 1, episodes = []; while ((match = regex.exec(seasonHtml)) !== null) { episodes.push({ href: match[1].trim(), number: episodeCount++, season: season }); } return episodes; }) .catch(err => { console.log(`Error fetching season ${season}:`, err); return []; }); }); const allSeasons = await Promise.all(seasonPromises); const results = allSeasons.flat(); return JSON.stringify(results); } catch (err) { return JSON.stringify([{ href: "Error", number: "Error", season: "Error" }]); } } async function extractStreamUrl(url) { try { const html = await (await fetchv2(url)).text(); const iframeMatch = html.match(/