带toripchange的selenium chrome webdriver

2024-05-29 11:54:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图打开谷歌搜索结果与硒。我使用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。我没有得到谷歌的回应


Tags: httpsipbrowsersearchgetusrcurrentchrome

热门问题