python - 如何绕过 Selenium 中的 Cloudflare bot 保护
问题描述
出于教育目的,我需要从网站上获取一些信息,但是由于受到保护,我无法发送请求。我得到了典型的 Checking-your-browser 页面首先出现,然后我被反复重定向。我如何在 python selenium 中绕过这种保护?
解决方案
我很久以前就遇到过这个问题,我能够解决它。使用下面的代码并享受:)
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
options.add_argument("--disable-blink-features=AutomationControlled")
driver = webdriver.Chrome(options=options, executable_path=r"webdriver\chromedriver.exe")
/////////// edit //////////////////现在不起作用!
推荐阅读
- python - 你如何创建一个包含所有行和值的新变量?
- angular - 如何告诉角度不更新视图
- python - python(opencv)中的图像分割 - 昆虫翅膀
- oracle - SQL Server 迁移助手 (SSMA) 在 Oracle 中看不到我的架构
- android - Android:导航组件中动作ID和片段ID之间的区别
- go - 如何使用过滤器进行websocket端口转发或在golang中保存(以数组形式)一些转发的数据包?
- asp.net-mvc - 如何关闭激活的会话并强制用户在身份服务器 4 中重新输入他的凭据?
- c# - 问题 - 使用 CEFSharp WinForm 将在使用代理时返回空白页
- xmlhttprequest - 是否可以将 AngularJS 的 $http 用作独立应用程序?
- c - 警告:函数“strcmp”的隐式声明