簡體   English   中英

selenium chrome webdriver 帶 toripchanger

[英]selenium chrome webdriver with toripchanger

我正在嘗試使用 selenium 打開谷歌搜索結果。 我使用 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。 我沒有得到谷歌的回應。

檢查代理工作后,試試這個。 刪除“https://”

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM