From eb493f28350af2cdbdcdbad8280a9aac76b25953 Mon Sep 17 00:00:00 2001 From: aka paul <80717571+50n50@users.noreply.github.com> Date: Thu, 4 Jun 2026 17:31:03 +0200 Subject: [PATCH] fix --- animepahe/animepahe.js | 61 ++++++++++++++++++++++------------------ animepahe/animepahe.json | 2 +- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/animepahe/animepahe.js b/animepahe/animepahe.js index d88905d..43784be 100644 --- a/animepahe/animepahe.js +++ b/animepahe/animepahe.js @@ -2,7 +2,7 @@ async function searchResults(keyword) { try { const encodedKeyword = encodeURIComponent(keyword); const ddosInterceptor = new DdosGuardInterceptor(); - const responseText = await ddosInterceptor.fetchWithBypass(`https://animepahe.com/api?m=search&q=${encodedKeyword}`); + const responseText = await ddosInterceptor.fetchWithBypass(`https://animepahe.pw/api?m=search&q=${encodedKeyword}`); const dataText = await responseText.text(); console.log(dataText); const data = JSON.parse(dataText); @@ -10,14 +10,14 @@ async function searchResults(keyword) { return { title: result.title, image: result.poster, - href: `https://animepahe.com/anime/${result.session}` + href: `https://animepahe.pw/anime/${result.session}` }; }); return JSON.stringify(transformedResults); } catch (error) { console.log("Fetch error in searchResults: " + error); - return JSON.stringify([{ title: "Error", image: "", href: "" }]); + return JSON.stringify([{ title: "Please wait a bit then try again!", image: "", href: "" }]); } } @@ -57,17 +57,17 @@ async function extractEpisodes(url) { if (!uuidMatch) throw new Error("Invalid URL"); const id = uuidMatch[1]; - const ddosInterceptor = new DdosGuardInterceptor(); + const ddosInterceptor = new DdosGuardInterceptor(); let page = 1; - const apiUrl1 = `https://animepahe.com/api?m=release&id=${id}&sort=episode_asc&page=${page}`; + const apiUrl1 = `https://animepahe.pw/api?m=release&id=${id}&sort=episode_asc&page=${page}`; const response1 = await ddosInterceptor.fetchWithBypass(apiUrl1); const dataText1 = await response1.text(); const data1 = JSON.parse(dataText1); for (const item of data1.data) { results.push({ - href: `https://animepahe.com/play/${id}/${item.session}`, + href: `https://animepahe.pw/play/${id}/${item.session}`, number: item.episode }); } @@ -81,7 +81,7 @@ async function extractEpisodes(url) { let retries = 0; while (!pageData && retries < 3) { try { - const apiUrl = `https://animepahe.com/api?m=release&id=${id}&sort=episode_asc&page=${pageNum}`; + const apiUrl = `https://animepahe.pw/api?m=release&id=${id}&sort=episode_asc&page=${pageNum}`; const response = await ddosInterceptor.fetchWithBypass(apiUrl); const dataText = await response.text(); pageData = JSON.parse(dataText); @@ -95,13 +95,13 @@ async function extractEpisodes(url) { return pageData; })(p)); } - + const allPagesData = await Promise.all(pagePromises); for (const pageData of allPagesData) { if (pageData && pageData.data) { for (const item of pageData.data) { results.push({ - href: `https://animepahe.com/play/${id}/${item.session}`, + href: `https://animepahe.pw/play/${id}/${item.session}`, number: item.episode }); } @@ -185,14 +185,14 @@ async function extractStreamUrl(url) { const parts = scriptContent.split('));eval('); if (parts.length === 2) { const layer2Packed = parts[1].substring(0, parts[1].length - 1); - try { unpacked = unpack(layer2Packed); } catch(e) {} + try { unpacked = unpack(layer2Packed); } catch (e) { } } } else { - try { unpacked = unpack(scriptContent); } catch(e) {} + try { unpacked = unpack(scriptContent); } catch (e) { } } if (unpacked) { - const urlMatch = unpacked.match(/const source=\\?['"]([^'"]+)['"]/) || - unpacked.match(/https:\/\/[^\s'";]+\.m3u8/); + const urlMatch = unpacked.match(/const source=\\?['"]([^'"]+)['"]/) || + unpacked.match(/https:\/\/[^\s'";]+\.m3u8/); if (urlMatch) { let hlsUrl = (urlMatch[1] || urlMatch[0]).replace(/\\+$/, ''); hlsUrl = hlsUrl.replace("/stream/", "/hls/").replace("uwu.m3u8", "owo.m3u8"); @@ -265,15 +265,20 @@ async function extractStreamUrl(url) { } } -// Fixed DDOS Bypass +// Fixed Bypass class DdosGuardInterceptor { constructor() { - this.errorCodes = [403]; - this.serverCheck = ["ddos-guard"]; - this.cookieStore = {}; + this.errorCodes = [403]; + this.serverCheck = ["ddos-guard"]; + this.cookieStore = {}; } async fetchWithBypass(url, options = {}) { + const solverUrl = `https://tmdbproxy22.simplepostrequest.workers.dev/solver?url=${encodeURIComponent(url)}&cache=1h`; + return fetchv2(solverUrl, options.headers || {}); + } + + async fetchWithBypassDdos(url, options = {}) { let response = await this.fetchWithCookies(url, options); let responseText = null; @@ -291,10 +296,10 @@ class DdosGuardInterceptor { return response; } - const isBlocked = responseText.includes('ddos-guard/js-challenge') || - responseText.includes('DDoS-Guard') || - responseText.includes('data-ddg-origin'); - + const isBlocked = responseText.includes('ddos-guard/js-challenge') || + responseText.includes('DDoS-Guard') || + responseText.includes('data-ddg-origin'); + if (!isBlocked) { response.text = async () => responseText; return response; @@ -309,7 +314,7 @@ class DdosGuardInterceptor { response.text = async () => responseText; return response; } - + return this.fetchWithCookies(url, options); } @@ -453,7 +458,7 @@ class Unbaser { this.unbase = this._dictunbaser; } } - + _dictunbaser(value) { let ret = 0; [...value].reverse().forEach((cipher, index) => { @@ -487,20 +492,20 @@ function unpack(source) { } throw Error("Could not make sense of p.a.c.k.e.r data (unexpected code structure)"); } - + let { payload, symtab, radix, count } = _filterargs(source); - + if (count != symtab.length) { throw Error("Malformed p.a.c.k.e.r. symtab."); } - + let unbase; try { unbase = new Unbaser(radix); } catch (e) { throw Error("Unknown p.a.c.k.e.r. encoding."); } - + function lookup(match) { const word = match; let word2; @@ -511,7 +516,7 @@ function unpack(source) { } return word2 || word; } - + source = payload.replace(/\b\w+\b/g, lookup); return source; } \ No newline at end of file diff --git a/animepahe/animepahe.json b/animepahe/animepahe.json index b91b9b1..f47a13f 100644 --- a/animepahe/animepahe.json +++ b/animepahe/animepahe.json @@ -5,7 +5,7 @@ "name": "50/50", "icon": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ3122kQwublLkZ6rf1fEpUP79BxZOFmH9BSA&s" }, - "version": "1.0.4", + "version": "1.2.0", "language": "English", "streamType": "HLS", "quality": "1080p",