我试图刮亚马逊时,运行无头与最新的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)当我删除options.add_argument的#(“-无头”)并运行代码时,我会得到一条服务器繁忙的线路。有人知道解决办法吗?
发布于 2022-01-14 10:38:52
要使用避检使用谷歌铬无头,通过add_argument()添加以下参数如下:
样本代码:
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")https://stackoverflow.com/questions/70709168
复制相似问题