Search code examples
node.jspuppeteercloudflare

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:

It seems like, that cloudflare knows, that I'm having headless activated.

Does anyone know, how I can skip the cloudflare redirecting page?


Solution

  • 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')