Created
April 2, 2026 11:50
-
-
Save Sighyu/653a4806188211237720384c8e98fd36 to your computer and use it in GitHub Desktop.
debug script to reverse anime.nexus streaming
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { chromium } = require('../node_modules/playwright'); | |
| const TARGET = 'https://anime.nexus'; | |
| (async () => { | |
| const browser = await chromium.launch({ | |
| headless: false, | |
| devtools: true, // auto-open DevTools for each new page; also press F12 manually anytime | |
| args: [ | |
| '--disable-blink-features=AutomationControlled', // suppress automation flag and related DevTools detection | |
| ], | |
| }); | |
| const context = await browser.newContext({ | |
| userAgent: | |
| 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36', | |
| viewport: { width: 1280, height: 800 }, | |
| extraHTTPHeaders: { | |
| 'sec-ch-ua': '"Google Chrome";v="131", "Chromium";v="131", "Not-A.Brand";v="24"', // plawywright's default UA client hints its a bot, so override with a more typical Chrome UA string | |
| 'sec-ch-ua-mobile': '?0', //playwright's default UA client hints mobile status as unknown, so explicitly set it to non-mobile | |
| 'sec-ch-ua-platform': '"Windows"',//playwright's default UA client hints platform as unknown, so explicitly set it to Windows | |
| }, | |
| }); | |
| // Remove navigator.webdriver and fix outer dimensions (bot fingerprint signals) | |
| await context.addInitScript(() => { | |
| Object.defineProperty(navigator, 'webdriver', { get: () => undefined, configurable: true }); //the site checks for navigator.webdriver to detect automation; override it to appear as a regular browser | |
| Object.defineProperty(window, 'outerWidth', { get: () => window.innerWidth, configurable: true }); //the site uses some freaky math to detect bot | |
| Object.defineProperty(window, 'outerHeight', { get: () => window.innerHeight + 40, configurable: true }); // same as above comment | |
| }); | |
| const page = await context.newPage(); | |
| // Block the google.com redirect interly | |
| await page.route('https://www.google.com/**', (route) => route.abort()); | |
| // this is why I use playwright over userscripts we cab patch the sites own script on the fly ez win | |
| await page.route('**', async (route) => { | |
| const req = route.request(); | |
| const url = req.url(); | |
| // check if anime.nexus | |
| if (!url.includes('anime.nexus') || req.resourceType() !== 'script') { | |
| return route.continue(); | |
| } | |
| try { | |
| const response = await route.fetch(); | |
| let body = await response.text(); | |
| // replace all instances of 'debugger' with 'void 0' to disable the anti-devtools detection that relies on the debugger statement | |
| body = body.replace(/\bdebugger\b/g, 'void 0'); | |
| // null the callbacks idk shit is obfuscated af | |
| body = body.replace(/'detectors':\[[^\]]*\]/g, "'detectors':[]"); | |
| await route.fulfill({ response, body }); | |
| } catch { | |
| route.continue(); | |
| } | |
| }); | |
| await page.goto("https://anime.nexus", { waitUntil: 'domcontentloaded' }); | |
| await page.pau | |
| console.log(`Opened "https://anime.nexus" the bot detection only shows up when streaming/watching a ep`); | |
| await new Promise((resolve) => browser.on('disconnected', resolve)); | |
| process.exit(0); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment