async function searchResults(keyword) { const results = []; const response = await fetchv2("https://ak.sv/search?q=" + encodeURIComponent(keyword)); const html = await response.text(); const filmListRegex = /
[\s\S]*?<\/div>\s*<\/div>/g; const items = html.match(filmListRegex) || []; items.forEach((itemHtml) => { const titleMatch = itemHtml.match(/

]*>([^<]+)<\/a>/); const href = titleMatch ? titleMatch[1] : ''; const title = titleMatch ? titleMatch[2] : ''; const imgMatch = itemHtml.match(/]*data-src="([^"]+)"[^>]*>/); const imageUrl = imgMatch ? imgMatch[1] : ''; if (title && href) { results.push({ title: title.trim(), image: imageUrl.trim(), href: href.trim(), }); } }); console.log(results); return JSON.stringify(results); } async function extractDetails(url) { const details = []; let description = 'N/A'; let aliases = 'N/A'; let airdate = 'N/A'; const genres = []; const response = await fetch(url); const html = await response.text(); const airdateMatch = html.match( /
\s*\s*السنة\s*:\s*(\d{4})\s*<\/span>\s*<\/div>/ ); if (airdateMatch) airdate = airdateMatch[1]; const descriptionMatch = html.match( /
]*>[\s\S]*?

([\s\S]*?)<\/p>/ ); if (descriptionMatch) { description = decodeHTMLEntities(descriptionMatch[1].replace(/<[^>]+>/g, '').trim()); } const genresMatch = html.match(/

([\s\S]*?)<\/div>/); const genresHtml = genresMatch ? genresMatch[1] : ''; const genreAnchorRe = /]*>([^<]+)<\/a>/g; let genreMatch; while ((genreMatch = genreAnchorRe.exec(genresHtml)) !== null) { genres.push(decodeHTMLEntities(genreMatch[1].trim())); } details.push({ description: description, airdate: airdate, aliases: genres.join(', ') || 'N/A' }); console.log(details); return JSON.stringify(details); } async function extractEpisodes(url) { const episodes = []; const response = await fetchv2(url); const html = await response.text(); const movieRegex = /]+href=["']([^"']+)["'][^>]+class=["'][^"']*link-btn link-show[^"']*["'][^>]*>/i; const movieMatch = movieRegex.exec(html); if (movieMatch && movieMatch[1]) { episodes.push({ href: movieMatch[1], number: 1 }); } else { const reversedHtml = html.split('\n').reverse().join('\n'); const episodeBlocks = reversedHtml.match(/