temporarily disabled crunchyroll turnstile handling
Some checks are pending
auto-documentation / documentation (push) Waiting to run
build and push docker image / build-node (push) Waiting to run
Style and build test / tsc (push) Waiting to run
Style and build test / eslint (push) Blocked by required conditions
Style and build test / prettier (push) Blocked by required conditions
Style and build test / build-test-windows-arm64 (push) Blocked by required conditions
Style and build test / build-test-linux-arm64 (push) Blocked by required conditions
Style and build test / build-test-macos-arm64 (push) Blocked by required conditions
Style and build test / build-test-windows-x64 (push) Blocked by required conditions
Style and build test / build-test-linux-x64 (push) Blocked by required conditions
Style and build test / build-test-macos-x64 (push) Blocked by required conditions

This commit is contained in:
stratumadev 2025-11-26 03:12:10 +01:00
parent 36811d9a7c
commit 96cec167e1
4 changed files with 113 additions and 772 deletions

View file

@ -1,7 +1,6 @@
import * as yamlCfg from './module.cfg-loader';
import * as yargs from './module.app-args';
import { console } from './log';
import { connect } from 'puppeteer-real-browser';
import { argvC } from './module.app-args';
import { ProxyAgent, fetch, RequestInit } from 'undici';
@ -30,13 +29,13 @@ type GetDataResponse = {
};
};
function hasDisplay(): boolean {
if (process.platform === 'linux') {
return !!process.env.DISPLAY || !!process.env.WAYLAND_DISPLAY;
}
// Win and Mac true by default
return true;
}
// function hasDisplay(): boolean {
// if (process.platform === 'linux') {
// return !!process.env.DISPLAY || !!process.env.WAYLAND_DISPLAY;
// }
// // Win and Mac true by default
// return true;
// }
// req
export class Req {
@ -85,36 +84,38 @@ export class Req {
const body = await res.text();
const docTitle = body.match(/<title>(.*)<\/title>/);
if (body && docTitle) {
if (docTitle[1] === 'Just a moment...' && durl.includes('crunchyroll') && hasDisplay()) {
console.warn('Cloudflare triggered, trying to get cookies...');
// if (docTitle[1] === 'Just a moment...' && durl.includes('crunchyroll') && hasDisplay()) {
// console.warn('Cloudflare triggered, trying to get cookies...');
const { page } = await connect({
headless: false,
turnstile: true
});
// const { page } = await connect({
// headless: false,
// turnstile: true
// });
await page.goto('https://www.crunchyroll.com/', {
waitUntil: 'networkidle2'
});
// await page.goto('https://www.crunchyroll.com/', {
// waitUntil: 'networkidle2'
// });
await page.waitForRequest('https://www.crunchyroll.com/auth/v1/token');
// await page.waitForRequest('https://www.crunchyroll.com/auth/v1/token');
const cookies = await page.cookies();
// const cookies = await page.cookies();
await page.close();
// await page.close();
params.headers = {
...params.headers,
Cookie: cookies.map((c) => `${c.name}=${c.value}`).join('; '),
'Set-Cookie': cookies.map((c) => `${c.name}=${c.value}`).join('; ')
};
// params.headers = {
// ...params.headers,
// Cookie: cookies.map((c) => `${c.name}=${c.value}`).join('; '),
// 'Set-Cookie': cookies.map((c) => `${c.name}=${c.value}`).join('; ')
// };
(params as any).headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36';
// (params as any).headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36';
return await this.getData(durl, params);
} else {
console.error(docTitle[1]);
}
// return await this.getData(durl, params);
// } else {
// console.error(docTitle[1]);
// }
console.error(docTitle[1]);
} else {
console.error(body);
}

View file

@ -55,7 +55,6 @@
"node-playready": "^1.1.1",
"open": "^11.0.0",
"protobufjs": "^7.5.4",
"puppeteer-real-browser": "^1.4.4",
"undici": "^7.16.0",
"widevine": "^1.0.3",
"ws": "^8.18.3",
@ -69,8 +68,8 @@
"@types/fs-extra": "^11.0.4",
"@types/node": "^24.10.1",
"@types/ws": "^8.18.1",
"@typescript-eslint/eslint-plugin": "^8.47.0",
"@typescript-eslint/parser": "^8.47.0",
"@typescript-eslint/eslint-plugin": "^8.48.0",
"@typescript-eslint/parser": "^8.48.0",
"@yao-pkg/pkg": "^6.10.1",
"esbuild": "0.26.0",
"eslint": "^9.39.1",
@ -79,7 +78,7 @@
"removeNPMAbsolutePaths": "^3.0.1",
"ts-node": "^10.9.2",
"typescript": "^5.9.3",
"typescript-eslint": "^8.47.0"
"typescript-eslint": "^8.48.0"
},
"scripts": {
"prestart": "pnpm run tsc test",

File diff suppressed because it is too large Load diff

View file

@ -9,6 +9,7 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"downlevelIteration": true,
"removeComments": true,
"jsx": "react"
},
"exclude": ["./videos", "./tsc.ts", "lib/**/*", "gui/react/**/*"]