Une bibliothèque Python pour automatiser Tor Browser avec Selenium.
Installation
Étape 1:
Installez Tor Browser Selenium Package.
pip install tbselenium
Étape 2:
Installez geckodriver dans votre machine ubuntu Vous devez également installer geckodriver v0.17.0 à partir de la geckodriver publie la page. Assurez-vous que vous installez la version v0.17.0; les versions plus récentes ou anciennes ne seront pas compatibles avec la série Tor Browser actuelle. Téléchargez le geckodriver et l’extraire. Le pilote doit être déplacé dans le répertoire /usr/local/bin/ et afficher la commande ci-dessous.
manivannan@manivannan-whirldatascience:~/pythonexamle/selenium_example$ tar -xvf geckodriver-v0.17.0-linux64.tar.gz
manivannan@manivannan-whirldatascience:~/pythonexamle/selenium_example$ sudo cp geckodriver /usr/local/bin/
Testez votre installation de geckodriver en exécutant la commande ci-dessous; il doit retourner geckodriver 0.17.0:
geckodriver --version
OUTPUT


Étape 3:
Tu devrais. Faiteswn Charge et extraire TBB et fournir son chemin lorsque vous initialisez TorBrowserDriver
manivannan@manivannan-whirldatascience:~/pythonexamle/selenium_example$ tar -xvJf tor-browser-linux64-7.5.4_en-US.tar.xz
Le fichier tar est extrait et c’est un répertoire.
Étape 4:
Installer xvfb paquet en cours d’exécution apt-get install xvfb .
manivannan@manivannan-whirldatascience:~/pythonexamle/selenium_example$ sudo apt-get install xvfb
Maintenant nous avons commencé le programme pour prendre une capture d’écran du navigateur Web. Créez le fichier python et collez le code ci-dessous.
from tbselenium.tbdriver import TorBrowserDriver from os.path import dirname, join, realpath, getsizeout_img = join(dirname(realpath(__file__)), "screenshot.png") with TorBrowserDriver("/home/manivannan/pythonexamle/selenium_example/tor-browser_en-US") as driver: driver.load_url('https://check.torproject.org', wait_for_page_body=True) print("----"*100) driver.get_screenshot_as_file(out_img) print("----"*100) print("Screenshot is saved as %s (%s bytes)" % (out_img, getsize(out_img)))
— — — — — — — — — — — —
Utilisez mon lien github de dépôt Ici. et je afficherai les programmes avancés à l’avenir.
未经允许不得转载:萌萌Apprentissage » Sélénium avec navigateur Tor en utilisant Python
Python lote pour extraire des images de moteurs de recherche
Le mot de Python grimpant à 100 degrés.
PythonTaiichi Taipei Intelligence artificielle Traitement graphique de Tensoflow
Je vais t'en chercher un nouveau, Shell.cloud.google en ligne.
exécuter crontab avec python sélénium tor navigateur affichage dans linux
Environnement Lineux Utilisez python pour appeler la page Web du navigateur ter aléatoire