function preprocessHtml(html) { //Module specefic, ignore return html.replace(/\\2605/g, '★'); } function searchResults(html) { html = preprocessHtml(html); const results = []; const baseUrl = "https://animebalkan.org/"; const filmListRegex = /
/g; const items = html.match(filmListRegex) || []; items.forEach((itemHtml) => { const titleMatch = itemHtml.match(/

([^<]+)<\/h2>/); const hrefMatch = itemHtml.match(/]+href="([^"]+)"[^>]*>/); const imgMatch = itemHtml.match(/]+src="([^"]+)"[^>]*>/); let title = titleMatch ? titleMatch[1].trim().replace(/–/g, '–') : ''; const href = hrefMatch ? hrefMatch[1].trim() : ''; const imageUrl = imgMatch ? imgMatch[1].trim() : ''; if (title && href) { results.push({ title, image: imageUrl.startsWith('http') ? imageUrl : baseUrl + imageUrl, href }); } }); return results; } function extractDetails(html) { const details = []; const descriptionMatch = html.match(/]*>([\s\S]*?)<\/span>/); const airdateMatch = html.match(/]*datetime="([^"]+)"/); if (descriptionMatch) { let description = descriptionMatch[1].trim() .replace(/–/g, '-') .replace(/—/g, '—') .replace(/“/g, '"') .replace(/”/g, '"') .replace(/…/g, '...') .replace(/″/g, '"') .replace(/′/g, "'"); let airdate = airdateMatch ? airdateMatch[1].split('T')[0] : ''; if (description && airdate) { details.push({ description: description, aliases: 'N/A', airdate: airdate }); } } return details; } function extractEpisodes(html) { const episodes = []; const episodeRegex = /[^<]*
([^<]+)<\/div>/g; let match; while ((match = episodeRegex.exec(html)) !== null) { const href = match[1]; let number = match[2]; const isMovie = href.includes('film') || href.includes('movie') || number.toLowerCase() === 'film'; if (isMovie) { number = '1'; } if (href.includes('epizoda-') || href.includes('specijalna-epizoda') || href.includes('-epizoda/') || href.includes('film') || href.includes('movie')) { episodes.push({ href: href, number: number }); } } episodes.reverse(); console.log(episodes); return episodes; } function extractStreamUrl(html) { const sourceRegex = /]*src="([^"]+)"/; const match = html.match(sourceRegex); if (match) { console.log(match[1]); return match[1]; } else { console.log("No stream URL found."); return null; } }