硒化铬webdriver与toripchanger

时间:2019-10-28 09:48:41

标签: python python-3.x python-2.7 selenium-webdriver selenium-chromedriver

我正试图用硒打开Goog​​le搜索结果。我使用toripchanger来迭代地更改ip。

tor_ip_changer = TorIpChanger(reuse_threshold=0,
                              local_http_proxy='127.0.0.1:8118')
ip = tor_ip_changer.get_new_ip()
current_ip = tor_ip_changer.get_current_ip()

PROXY = "%s:8118" % ip
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=https://%s' % PROXY)
browser = webdriver.Chrome("/usr/lib/chromium-browser/chromedriver",
                           options=chrome_options)
browser_1 = webdriver.Chrome("/usr/lib/chromium-browser/chromedriver",
                             options=chrome_options)

search_query = "microsoft site:instagram.com"
browser.get("https://www.google.com/search?q=" + search_query + "&start=" + str(10 * i))

但是驱动程序无法打开URL。我没有收到Google的回复。

1 个答案:

答案 0 :(得分:0)

检查代理服务器工作后,请尝试此操作。删除“ https://”

chrome_options.add_argument('--proxy-server=%s' % PROXY)