async function searchResults(keyword) { const searchUrl = `https://ahs.turkish123.com/?s=${encodeURIComponent(keyword)}`; try { const response = await fetchv2(searchUrl); const html = await response.text(); const results = []; const itemRegex = /
([\s\S]*?)<\/p>/);
let description = descriptionMatch ? descriptionMatch[1].trim() : 'Weirdly the website doesn\'t provide any description, either that or I\'m blind.';
description = description.replace(/–/g, '–').replace(/’/g, '’');
const yearMatch = html.match(/<\/i>Year:<\/strong>[\s\S]*?(\d{4})<\/a>/);
const airdate = yearMatch ? yearMatch[1] : 'N/A';
details.push({
description,
alias: 'N/A',
airdate
});
return JSON.stringify(details);
} catch (error) {
return JSON.stringify([]);
}
}
async function extractEpisodes(url) {
const response = await fetchv2(url);
const html = await response.text();
const episodes = [];
const episodeMatches = html.match(/[^<]*Episode (\d+)[^<]*(?:]*>[^<]*<\/span>)?[^<]*<\/a>/g);
if (episodeMatches) {
episodeMatches.forEach((match) => {
const hrefMatch = match.match(/href="([^"]+)"/);
const episodeNumberMatch = match.match(/Episode (\d+)/);
if (hrefMatch && episodeNumberMatch) {
episodes.push({
href: hrefMatch[1].trim(),
number: parseInt(episodeNumberMatch[1], 10)
});
}
});
}
return JSON.stringify(episodes);
}
async function extractStreamUrl(url) {
try {
const response = await fetchv2(url);
const html = await response.text();
const downloadNaviMatch = html.match(/