【发布时间】:2021-12-30 04:51:09
【问题描述】:
我正在尝试更改我的 IP 地址以绕过使用此代码抓取社交数据:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
if __name__ == '__main__':
chromedriver_path = '/usr/local/bin/chromedriver'
window_size = "1920,1080"
chrome_options = Options()
chrome_options.add_argument("--window-size=%s" % window_size)
random_proxy = '124.240.187.80:82'
webdriver.DesiredCapabilities.CHROME['proxy'] = {
"httpProxy": random_proxy,
"ftpProxy": random_proxy,
"sslProxy": random_proxy,
"proxyType": "MANUAL"
}
webdriver.DesiredCapabilities.CHROME['acceptSslCerts'] = True
chromedriver = webdriver.Chrome(
executable_path=chromedriver_path,
options=chrome_options
)
chromedriver.get('https://whatismyip.com')
但它不起作用。我的 IP 地址保持不变。有什么建议吗? 非常感谢。
【问题讨论】:
标签: python selenium selenium-webdriver web-crawler