temp fix: add 30s delay

credit: @realivanjx
https://github.com/FlareSolverr/FlareSolverr/issues/481#issuecomment-1242951929
This commit is contained in:
ilike2burnthing 2022-09-12 01:44:01 +01:00 committed by GitHub
parent ce52321b78
commit 0e2452e40e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,8 @@ const CAPTCHA_SELECTORS: string[] = [
'#cf-challenge-hcaptcha-wrapper', '#cf-norobot-container', 'input[name="cf_captcha_kind"]'
];
const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms))
export default async function resolveChallenge(url: string, page: Page, response: HTTPResponse): Promise<HTTPResponse> {
// look for challenge and return fast if not detected
@ -78,6 +80,8 @@ export default async function resolveChallenge(url: string, page: Page, response
if (displayStyle == "none") {
// spinner is hidden, could be a captcha or not
log.debug('Challenge element is hidden')
log.debug("Waiting for 30 secs");
await delay(30 * 1000);
// wait until redirecting disappears
while (true) {
try {