Selenium Chrome 配置:绕过反爬虫检测
这四行代码是用于配置 Chrome 浏览器,以绕过网站的反爬虫检测机制。
-
'options = webdriver.ChromeOptions()':创建 ChromeOptions 对象,用于配置 Chrome 浏览器。
-
'options.add_argument('--disable-blink-features=AutomationControlled')':禁用 Chrome 浏览器的自动化控制特性,防止被网站检测到使用了自动化工具。
-
'options.add_experimental_option('excludeSwitches', ['enable-automation'])':排除 Chrome 浏览器的 'enable-automation' 选项,同样是为了防止被网站检测到使用了自动化工具。
-
'options.add_experimental_option('useAutomationExtension', False)':禁用 Chrome 浏览器的自动化扩展,同样是为了防止被网站检测到使用了自动化工具。
通过以上配置,可以有效地降低被网站识别为自动化工具的概率,提高爬虫的成功率。
原文地址: https://www.cveoy.top/t/topic/ohM1 著作权归作者所有。请勿转载和采集!