【发布时间】:2020-12-11 04:27:24
【问题描述】:
我正在制作一个应用程序(在 Chrome 中使用 Selenium webdriver),它可以在 Google 上搜索指定的查询 (http://www.google.com/search?query),但每次搜索它时我都想更改我的 IP,所以我使用了代理。
问题是 Google 阻止了我使用的每个代理。反正有绕过它吗?也许我使用了错误类型的代理? (我尝试过 HTTP 和 HTTPS 代理,但每次都被阻止)
也许我的代码错了?:
from selenium import webdriver
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
options = Options()
options.binary_location = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
options.add_argument("disable-extensions")
options.add_argument("start-maximized")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option("useAutomationExtension", False)
options.add_argument(f"--proxy-server=ip:port")
driver = Chrome(options=options, executable_path="C:/WebDriver/bin/chromedriver.exe")
driver.get("http://www.google.com/search?query")
这可能是代理质量的问题吗?
【问题讨论】:
标签: python python-3.x selenium selenium-webdriver proxy