【问题标题】:using the Firefox Profile and the tor daemon doesn't work使用 Firefox 配置文件和 Tor 守护程序不起作用
【发布时间】:2019-12-28 10:26:12
【问题描述】:

我想使用 tor 浏览器绕过审查,但使用 Firefox 配置文件和 tor 守护程序不起作用。这是我的代码:

from selenium import webdriver
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
import os

torexe = os.popen(r'C:\Users\fathollahy\Desktop\Tor Browser\Browser\TorBrowser\Tor\tor.exe')
profile = FirefoxProfile(r'C:\Users\fathollahy\Desktop\Tor Browser\Browser\TorBrowser\Data\Browser\profile.default')
profile.set_preference('network.proxy.type', 1)
profile.set_preference('network.proxy.socks', '127.0.0.1')
profile.set_preference('network.proxy.socks_port', 9050)
profile.set_preference("network.proxy.socks_remote_dns", False)
profile.update_preferences()
driver = webdriver.Firefox(firefox_profile= profile, executable_path=r'geckodriver.exe')
driver.get("http://check.torproject.org")

浏览器快照: doesn't work

正常网站不会打开,只是加载。 我从here得到了代码。

【问题讨论】:

    标签: python python-3.x selenium selenium-webdriver tor


    【解决方案1】:

    其实你应该把 sock_port 改成 9150。

    【讨论】:

    • 正常网站的问题已解决,但我无法连接到被审查的网站。
    猜你喜欢
    • 1970-01-01
    • 2016-04-20
    • 2018-01-02
    • 1970-01-01
    • 2012-08-07
    • 2014-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多