mirror of
https://git.luna-app.eu/50n50/sources
synced 2025-12-22 13:46:29 +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) {
|
async function searchResults(keyword) {
|
||||||
const results = [];
|
const results = [];
|
||||||
try {
|
try {
|
||||||
|
|
@ -8,7 +15,7 @@ async function searchResults(keyword) {
|
||||||
let match;
|
let match;
|
||||||
while ((match = regex.exec(html)) !== null) {
|
while ((match = regex.exec(html)) !== null) {
|
||||||
results.push({
|
results.push({
|
||||||
title: match[2].trim(),
|
title: cleanTitle(match[2].trim()),
|
||||||
image: match[3] ? match[3].trim() : "",
|
image: match[3] ? match[3].trim() : "",
|
||||||
href: match[1].trim()
|
href: match[1].trim()
|
||||||
});
|
});
|
||||||
|
|
@ -86,12 +93,35 @@ async function extractEpisodes(url) {
|
||||||
async function extractStreamUrl(url) {
|
async function extractStreamUrl(url) {
|
||||||
|
|
||||||
const response = await fetchv2(url);
|
const response = await fetchv2(url);
|
||||||
const html = await response.text();
|
const htmlOne = await response.text();
|
||||||
let streamData = null;
|
|
||||||
|
|
||||||
streamData = voeExtractor(html);
|
const redirectMatch = htmlOne.match(/window\.location\.href\s*=\s*['"]([^'"]+)['"]/);
|
||||||
console.log("Voe Stream Data: " + streamData);
|
if (!redirectMatch) {
|
||||||
return streamData;
|
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 */
|
/* SCHEME START */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue