async function searchResults(keyword) {
const results = [];
const regex = /
]*>\s*([^<]+)\s*<\/a>/g;
try {
const response = await fetchv2("https://www.1tamilcrow.net/?s=" + keyword);
const html = await response.text();
let match;
while ((match = regex.exec(html)) !== null) {
results.push({
href: match[2].trim(),
title: decodeHtml(match[3].trim()),
image: match[1] ? match[1].trim() : "No Image"
});
}
return JSON.stringify(results);
} catch (err) {
return JSON.stringify([{
title: "Error",
image: "Error",
href: "Error"
}]);
}
}
function decodeHtml(str) {
return str
.replace(/&/g, "&")
.replace(/’/g, "’")
.replace(/"/g, "\"")
.replace(/'/g, "'")
.replace(/</g, "<")
.replace(/>/g, ">");
}
async function extractDetails(url) {
try {
return JSON.stringify([{
description: "No description on the website",
aliases: "N/A",
airdate: "N/A"
}]);
} catch (err) {
return JSON.stringify([{
description: "Error",
aliases: "Error",
airdate: "Error"
}]);
}
}
async function extractEpisodes(url) {
const results = [];
try {
const response = await fetchv2(url);
const html = await response.text();
console.log(html);
const regex = /