async function searchResults(keyword) { const results = []; const baseUrl = "https://www.animesrbija.com"; const response = await fetchv2("https://www.animesrbija.com/filter?search=" + encodeURIComponent(keyword)); const html = await response.text(); const animeItems = html.match(/
.*?<\/h3><\/a><\/div>/gs) || []; animeItems.forEach(itemHtml => { const titleMatch = itemHtml.match(/

.*?src="([^"]+)".*?<\/noscript>/s); const title = titleMatch ? titleMatch[1].trim() : ''; const href = hrefMatch ? baseUrl + hrefMatch[1].trim() : ''; let imageUrl = ''; if (imgMatch) { let srcUrl = imgMatch[1]; if (srcUrl.includes('/_next/image?url=')) { const urlParam = srcUrl.match(/url=([^&]+)/); if (urlParam) { imageUrl = baseUrl + decodeURIComponent(urlParam[1]); } } else { imageUrl = srcUrl.startsWith('http') ? srcUrl : baseUrl + srcUrl; } } if (title && href) { results.push({ title, image: imageUrl, href }); } }); console.log(results); return JSON.stringify(results); } async function extractDetails(url) { const details = []; const response = await fetchv2(url); const html = await response.text(); const descriptionMatch = html.match(/
([\s\S]*?)<\/div>/); let description = descriptionMatch ? descriptionMatch[1] .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/
\n/g, ' ') .replace(/\s+/g, ' ') .trim() : ''; const nameMatch = html.match(/

([^<]+)<\/h3>/); const airdateMatch = html.match(/Datum:<\/span>([^<]+)/); let airdate = airdateMatch ? airdateMatch[1].trim() : ''; let name = nameMatch ? nameMatch[1].trim() : ''; let engName = engNameMatch ? engNameMatch[1].trim() : ''; let aliases = name === engName ? 'N/A' : engName; if (description || airdate) { details.push({ description: description, aliases: aliases, airdate: airdate }); } console.log(details); return JSON.stringify(details); } async function extractEpisodes(url) { const episodes = []; const response = await fetchv2(url); const html = await response.text(); const baseUrl = 'https://www.animesrbija.com'; const episodeRegex = /\s*([^<]+)<\/span>\s*