mirror of
https://git.luna-app.eu/50n50/sources
synced 2025-12-21 13:16:21 +01:00
Update toonitalia/toonitalia.js
This commit is contained in:
parent
28c025cd86
commit
e8ce789f0b
1 changed files with 36 additions and 6 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue