From 611cbc8e1a63e5af4e7ba82fd38a60e394d239eb Mon Sep 17 00:00:00 2001 From: aka paul <50n50@noreply.localhost> Date: Wed, 25 Mar 2026 17:20:22 +0000 Subject: [PATCH] Update animelib/animelib.js --- animelib/animelib.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/animelib/animelib.js b/animelib/animelib.js index 55479ac..9b3eff0 100644 --- a/animelib/animelib.js +++ b/animelib/animelib.js @@ -95,7 +95,8 @@ async function extractEpisodes(slug) { async function extractStreamUrl(ID) { try { - const response = await fetchv2("https://hapi.hentaicdn.org/api/episodes/" + ID); + const url = "https://hapi.hentaicdn.org/api/episodes/" + ID; + const response = await fetchv2(url); const json = await response.json(); const data = json.data || {}; @@ -104,7 +105,6 @@ async function extractStreamUrl(ID) { const order = { Animelib: 0, Kodik: 1 }; return (order[a.player] ?? 99) - (order[b.player] ?? 99); }); - const parserPromises = players .filter(player => player.team && player.team.name) .map(async (player) => { @@ -128,7 +128,10 @@ async function extractStreamUrl(ID) { streamUrl = 'https://video1.cdnlibs.org/.%D0%B0s/' + streamUrl; } } else if (player.player === "Kodik" && player.src) { - const kodikUrl = "https:" + player.src; + let kodikUrl = player.src; + if (!kodikUrl.startsWith('http')) { + kodikUrl = "https:" + kodikUrl; + } const qualitiesJson = await kodikParser(kodikUrl); const qualities = JSON.parse(qualitiesJson); @@ -160,19 +163,19 @@ async function extractStreamUrl(ID) { return null; } catch (err) { + console.error("[extractStreamUrl] Player processing error:", err.message, err.code); return null; } }); const results = await Promise.all(parserPromises); - const streams = results.filter(stream => stream !== null); - return JSON.stringify({ streams: streams, subtitle: "https://none.com" }); } catch (err) { + console.error("[extractStreamUrl] ERROR:", err.message); return JSON.stringify({ streams: [], subtitle: "https://none.com" @@ -206,17 +209,17 @@ async function kodikParser(url) { `&pd_sign=${urlParams.pd_sign}` + `&ref=${urlParams.ref}` + `&ref_sign=${urlParams.ref_sign}` + - `&bad_user=false&cdn_is_working=false` + + `&bad_user=false&cdn_is_working=true` + `&type=${videoInfo_type}&hash=${videoInfo_hash}&id=${videoInfo_id}&info=%7B%7D`; const headers2 = { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", - "Referer": "https://kodik.info", + "Referer": "https://v3.animelib.org/", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3", "X-Requested-With": "XMLHttpRequest" }; - const apiResponse = await fetchv2("https://kodik.info/ftor", headers2, "POST", finalData); + const apiResponse = await fetchv2("https://kodikplayer.com/ftor", headers2, "POST", finalData); const apiJson = await apiResponse.json(); const qualities = {}; @@ -239,7 +242,7 @@ async function kodikParser(url) { return JSON.stringify(qualities, null, 2); } catch (error) { - console.log(error); + console.error("[kodikParser] ERROR:", error.message); return JSON.stringify({ error: "error.org" }); } }