Answer the question
In order to leave comments, you need to log in
PhantomJS+Selenium+Tor. How to implement this link?
Good afternoon. There are 2 scripts, but I would like to combine them to implement the above bundle...
1. PhantomJS script
The simplest script for checking the IP address
import requesocks
from selenium import webdriver
browser = webdriver.PhantomJS()
browser.get('http://check-host.net/ip')
browser.get_screenshot_as_file('res2.png')
browser.quit()
import requesocks
from stem import Signal
from stem.control import Controller
session = requesocks.session()
session.proxies = {'http': 'socks5://127.0.0.1:9150',
'https': 'socks5://127.0.0.1:9150'}
with Controller.from_port(port = 9151) as controller:
controller.authenticate(password="password")
controller.signal(Signal.NEWNYM)
print session.get("http://httpbin.org/ip").text
Answer the question
In order to leave comments, you need to log in
service_args = [
'--proxy=127.0.0.1:9150',
'--proxy-type=socks5',
]
browser = webdriver.PhantomJS(service_args=service_args)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question