Update animeworld/animeworld.js
Fetch and Save Remote Content / fetch (push) Failing after 11m45s

This commit is contained in:
2026-06-02 11:52:41 +00:00
parent 74f821afd0
commit 059bc19173
+14 -27
View File
@@ -3,9 +3,7 @@ async function searchResults(keyword) {
const baseUrl = "https://animeworld.ac"; const baseUrl = "https://animeworld.ac";
try { try {
const response = await soraFetch( const response = await soraFetch(`${baseUrl}/search?keyword=${encodeURIComponent(keyword)}`);
`${baseUrl}/search?keyword=${encodeURIComponent(keyword)}`
);
const html = await response.text(); const html = await response.text();
const filmListRegex = const filmListRegex =
@@ -74,9 +72,7 @@ async function extractDetails(url) {
const aliasesMatch = html.match(/<h2 class="title" data-jtitle="([^"]+)">/); const aliasesMatch = html.match(/<h2 class="title" data-jtitle="([^"]+)">/);
let aliases = aliasesMatch ? aliasesMatch[1] : ""; let aliases = aliasesMatch ? aliasesMatch[1] : "";
const airdateMatch = html.match( const airdateMatch = html.match(/<dt>Data di Uscita:<\/dt>\s*<dd>([^<]+)<\/dd>/);
/<dt>Data di Uscita:<\/dt>\s*<dd>([^<]+)<\/dd>/
);
let airdate = airdateMatch ? airdateMatch[1] : ""; let airdate = airdateMatch ? airdateMatch[1] : "";
if (description && aliases && airdate) { if (description && aliases && airdate) {
@@ -103,8 +99,7 @@ async function extractEpisodes(url) {
const episodes = []; const episodes = [];
const baseUrl = "https://animeworld.ac"; const baseUrl = "https://animeworld.ac";
const serverActiveRegex = const serverActiveRegex = /<div class="server active"[^>]*>([\s\S]*?)<\/ul>\s*<\/div>/;
/<div class="server active"[^>]*>([\s\S]*?)<\/ul>\s*<\/div>/;
const serverActiveMatch = html.match(serverActiveRegex); const serverActiveMatch = html.match(serverActiveRegex);
if (!serverActiveMatch) { if (!serverActiveMatch) {
@@ -112,8 +107,7 @@ async function extractEpisodes(url) {
} }
const serverActiveContent = serverActiveMatch[1]; const serverActiveContent = serverActiveMatch[1];
const episodeRegex = const episodeRegex = /<li class="episode">\s*<a[^>]*?href="([^"]+)"[^>]*?>([^<]+)<\/a>/g;
/<li class="episode">\s*<a[^>]*?href="([^"]+)"[^>]*?>([^<]+)<\/a>/g;
let match; let match;
while ((match = episodeRegex.exec(serverActiveContent)) !== null) { while ((match = episodeRegex.exec(serverActiveContent)) !== null) {
@@ -144,31 +138,24 @@ async function extractEpisodes(url) {
async function extractStreamUrl(url) { async function extractStreamUrl(url) {
try { try {
const response = await soraFetch(url); const pathParts = url.split('/');
const html = await response.text(); const code = pathParts[pathParts.length - 1];
const idRegex = /<a[^>]+href="([^"]+)"[^>]*id="alternativeDownloadLink"/; const apiUrl = `https://www.animeworld.ac/api/episode/info?id=${code}&alt=0`;
const match = html.match(idRegex);
return match ? match[1] : null; const response = await soraFetch(apiUrl);
const json = JSON.parse(await response.text());
return json.grabber;
} catch (error) { } catch (error) {
console.log("Stream URL error:", error); console.log("Stream URL error:", error);
return "https://files.catbox.moe/avolvc.mp4"; return "https://files.catbox.moe/avolvc.mp4";
} }
} }
async function soraFetch( async function soraFetch(url, options = { headers: {}, method: "GET", body: null, encoding: "utf-8" }) {
url,
options = { headers: {}, method: "GET", body: null, encoding: "utf-8" }
) {
try { try {
return await fetchv2( return await fetchv2(url, options.headers ?? {}, options.method ?? "GET", options.body ?? null, true, options.encoding ?? "utf-8");
url,
options.headers ?? {},
options.method ?? "GET",
options.body ?? null,
true,
options.encoding ?? "utf-8"
);
} catch (e) { } catch (e) {
try { try {
return await fetch(url, options); return await fetch(url, options);