首页 > 解决方案 > 如何让 puppeteer 等待来自 Cloudflare 浏览器检查的页面重定向?

问题描述

我正在抓取一个网站,在提交表单后我被重定向到这个 -

Checking your browser before accessing <Website Name>.
This process is automatic. Your browser will redirect to your requested content shortly.

Please allow up to 5 seconds…

DDoS protection by Cloudflare
Ray ID: <Some ID>

现在,通常当我自己从“真正的网络浏览器”手动提交该表单时,我几乎会在浏览器检查内容出现后立即重定向到主要内容。但在 puppeteer 中,它没有。

我试过使用page.waitForNavigation(),但我无法让它工作。有没有办法真正通过这个检查过程?或者 puppeteer 只是被阻止了?

提前致谢!

标签: javascriptbrowserpuppeteercloudflareddos

解决方案


您可以使用puppeteer-extra来添加不同的插件,例如StealthPluginAdblockerPlugin. 看看他们的文档。


推荐阅读