在无头铬硒上检测到



当我使用最新的UserAgent无头运行时,我正试图刮取亚马逊,我的费率受到限制。当我走出无头线时,我不会被检测到或受到速率限制。下面是我的代码!

options = Options()
options.add_experimental_option("excludeSwitches", ["enable-logging"])
options.add_experimental_option("useAutomationExtension", False)
#options.add_argument("--headless")
options.add_argument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36")
service = ChromeService(executable_path=ChromeDriverManager().install())
browser = webdriver.Chrome(service=service, options=options)
browser.get("https://www.amazon.com.au/Oculus-Quest-2-Virtual-Reality-Headset/dp/B08FSZ8QWH")
print(browser.page_source)

当我删除#at-options.add_argument("--headless"(并运行代码时,我得到了一条服务器繁忙的线路。有人知道解决办法吗?

为了避免使用google chrome headless进行检测,请通过add_argument()添加以下参数,如下所示:

--disable-blink-features=AutomationControlled

示例代码:

options = Options()
options.headless = True
options.add_argument("start-maximized")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('excludeSwitches', ['enable-logging'])
options.add_experimental_option('useAutomationExtension', False)
options.add_argument('--disable-blink-features=AutomationControlled')
s = Service('C:\BrowserDrivers\chromedriver.exe')
driver = webdriver.Chrome(service=s, options=options)
driver.get("https://www.amazon.com.au/Oculus-Quest-2-Virtual-Reality-Headset/dp/B08FSZ8QWH")

相关内容

  • 没有找到相关文章

最新更新