From e8ce789f0bf4ffbd4a870c1508ea46726f81c169 Mon Sep 17 00:00:00 2001 From: aka paul <50n50@noreply.localhost> Date: Sun, 2 Nov 2025 15:27:57 +0000 Subject: [PATCH] Update toonitalia/toonitalia.js --- toonitalia/toonitalia.js | 42 ++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/toonitalia/toonitalia.js b/toonitalia/toonitalia.js index e9c00af..d5dd02a 100644 --- a/toonitalia/toonitalia.js +++ b/toonitalia/toonitalia.js @@ -1,3 +1,10 @@ +function cleanTitle(title) { + return title + .replace(/’/g, "'") + .replace(/–/g, "-") + .replace(/&#[0-9]+;/g, ""); +} + async function searchResults(keyword) { const results = []; try { @@ -8,7 +15,7 @@ async function searchResults(keyword) { let match; while ((match = regex.exec(html)) !== null) { results.push({ - title: match[2].trim(), + title: cleanTitle(match[2].trim()), image: match[3] ? match[3].trim() : "", href: match[1].trim() }); @@ -86,12 +93,35 @@ async function extractEpisodes(url) { async function extractStreamUrl(url) { const response = await fetchv2(url); - const html = await response.text(); - let streamData = null; + const htmlOne = await response.text(); - streamData = voeExtractor(html); - console.log("Voe Stream Data: " + streamData); - return streamData; + const redirectMatch = htmlOne.match(/window\.location\.href\s*=\s*['"]([^'"]+)['"]/); + if (!redirectMatch) { + console.log("No redirect URL found"); + return null; + } + + const redirectUrl = redirectMatch[1]; + console.log("Redirect URL: " + redirectUrl); + + const actualResponse = await fetchv2(redirectUrl); + const html = await actualResponse.text(); + + let streamUrl = voeExtractor(html); + console.log("Voe Stream Data: " + streamUrl); + + return JSON.stringify({ + streams: [ + { + title: "Server 1", + streamUrl: streamUrl, + headers: { + Referer: redirectUrl + } + } + ], + subtitle: "https://none.com" + }); } /* SCHEME START */