'Cloudflare bypass with Puppeteer
I'm trying to enter hotbit.io, with my Puppeteer. But I'm met with "Checking your browser before accessing www.hotbit.io" the moment puppeteer tries entering the page. When I run my program in "headless: false" it redirects to the page after 5 seconds. But my problem is, that I want to run it in headless: true. When I run it in headless: true, it timesout on the cloudflare page Screenshot at timeout
I have tried:
- "puppeteer-extra-plugin-stealth"
- "Cloudflare-scraper (https://www.npmjs.com/package/cloudflare-scraper)". This has very limited documentation (non-existing), but I saw under "Issues" on their github, that it is not supported anymore.
It seems like, that cloudflare knows, that I'm having headless activated.
Does anyone know, how I can skip the cloudflare redirecting page?
Solution 1:[1]
Thank you @BGPHiJACK !
It helped by setting user agent to: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0
So right after I have init the page, I set user agent.
const page = await browser.newPage();
await page.setUserAgent('Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ivan G. |
