Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

No option to enable cookies and ditch bots #147

Open
alpharameeztech opened this issue Aug 9, 2021 · 4 comments
Open

No option to enable cookies and ditch bots #147

alpharameeztech opened this issue Aug 9, 2021 · 4 comments

Comments

@alpharameeztech
Copy link

alpharameeztech commented Aug 9, 2021

How to enable cookies with puphpeteer using headless mode

Most sites can detect puphpeteer as we can not set the cookies so the bots can detect.

Here is the error when I try load the webiste in headless mode

Code

$headless = true;

        $puppeteer = new Puppeteer([
            'read_timeout'     => null,
            'idle_timeout'     => null,
            'log_node_console' => false,
            'headless'         => $headless,
        ]);
        $this->browser = $puppeteer->launch([
            'headless' => $headless,
            'timeout'  => 0,
            'args'     => [
                '--no-sandbox',
                '--disable-setuid-sandbox',
                '--user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.' . rand(1, 50) . ' (KHTML, like Gecko) Chrome/65.0.2112.0 Safari/537.' . rand(1, 50) . '"'
            ]
        ]);
        $this->page = $this->browser->newPage();

Reproducible example

Complete this security check to prove that you’re a human. Once you’ve passed this page, you might need to navigate away from your current screen on Kickstarter to refresh and move on.
--
  |To avoid seeing this page again, double-check that JavaScript and cookies are enabled on your web browser and that you’re not blocking them from loading with an extension (e.g., ad blockers)

Screenshot from 2021-08-09 17-08-06

*Please let me know how can I set the cookies ASAP

@msouto346
Copy link

Did you find any solution for this? I cannot bypasse Cloudflare protection.

@beshoo
Copy link

beshoo commented Oct 19, 2021

same here!

@JJery-web
Copy link

same here! Please help for Kickstarter scrape.

@PavelMove
Copy link

No bug here. It's not a problem of saving cookies. All cookies are managed well, when you using headless mode. No any "fix" can be provided by the project.

The problem is out of scope of this project. It's just that Kickstarter, Cloudflare and many other sites are informed about puppeteer (which is used by puphpeteer under the hood) existence, and know, how to detect it. If you want to bypass this protection, then you need to google the right question. Try to start from the other side with something like "how to detect puppeteer visitors" and dig deeper.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants