Skip to content

Commit

Permalink
Improve Cloudflare IP ban detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ngosang committed Aug 1, 2021
1 parent 6dd8206 commit fdb3eae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/providers/cloudflare.ts
Expand Up @@ -20,8 +20,8 @@ export default async function resolveChallenge(url: string, page: Page, response
}
log.info('Cloudflare detected');

if (await page.$('.cf-error-code')) {
throw new Error('Cloudflare has blocked this request (Code 1020 Detected).')
if (await page.$('span[data-translate="error"]') || (await page.content()).includes('error code: 1020')) {
throw new Error('Cloudflare has blocked this request. Probably your IP is banned for this site, check in your web browser.')
}

let selectorFoundCount = 0;
Expand Down

0 comments on commit fdb3eae

Please sign in to comment.