抓取网页时出现空响应错误

时间:2021-07-19 06:54:19

标签: python selenium web web-scraping

我正在使用 selenium 创建一个网络爬虫,它应该搜索网站中的公司,但是在爬行时,我在被重定向到搜索结果所在的页面后得到一个错误的空响应。该网站是否可能以某种方式检测到我是机器人并阻止我,我该如何解决? 这是我设置的选项

options = webdriver.ChromeOptions()
options.add_argument("--ignore-certificate-errors")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
options.add_argument('--disable-blink-features=AutomationControlled')
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_argument("--disable-extensions")
options.add_argument(f'user-agent={self.user_agent}')
USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0'

0 个答案:

没有答案