javascript - 如何让 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 只是被阻止了?
提前致谢!
解决方案
您可以使用puppeteer-extra来添加不同的插件,例如StealthPlugin
或AdblockerPlugin
. 看看他们的文档。
推荐阅读
- visual-studio - 如何在 Windows server 2012 中安装没有 Visual Studio 2015 的 Crystal Report?
- sql-server - 如何按天和小时字段进行排序?
- listview - React Native 中的平滑动画滚动视图
- javascript - 如何使用Nodejs查找每个数组对象的位置
- excel - 为文本列分配一个新的唯一 int 列
- jquery - 修复了 jQuery 可排序列表中的项目
- angularjs - 服务器端框架与客户端框架
- pubnub - 发布访问拒绝异常。错误数据=PNErrorData(信息=空
- node.js - 由于节点 js 内存不足,NPM 命令显示中止消息
- xcode - 重新编译没有沙箱的旧可可应用程序