using the Firefox Profile and the tor daemon doesn't work

谁都会走 提交于 2020-01-14 03:36:15

问题


I want to use tor browser to bypass censorship but using the Firefox Profile and the tor daemon doesn't work. here's my code:

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")

Browser Snapshot: doesn't work

and normal sites don't open and just loading. I got the code from here.


回答1:


Actually, You should change the sock_port to 9150.



来源:https://stackoverflow.com/questions/59510020/using-the-firefox-profile-and-the-tor-daemon-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!