如何通过带有硒的TOR浏览器访问网站时避免检测?

问题描述 投票:-2回答:1

我一直在尝试抓取网站一段时间,当您使用蛮力从一个网站检索有关500.000+网址的所有信息时,您可能会被屏蔽。因此,我现在正尝试使用selenium webdriver通过TOR浏览器抓取我的数据。到现在为止还挺好。启动并运行:

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

torexe = os.popen(r'C:/location_to/Tor Browser/Browser/TorBrowser/Tor/tor.exe')
profile = FirefoxProfile(r"C:/location_to/Tor Browser/Browser/TorBrowser/Data/Browser/Caches/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'C:/Location_to/geckodriver-v0.25.0-win64/geckodriver.exe')
driver.get("http://check.torproject.org")

导致:恭喜。该浏览器配置为使用Tor。您的IP地址似乎是:94.230.208.147

大。但是,当我尝试访问某些网站时,会检测到:

driver.get("https://gearbest.com")
raw_html = driver.page_source
clean_html = soup(raw_html, 'html.parser')

拒绝访问您无权访问此服务器上的“ http://gearbest.com/”。参考#18.cff31502.1569612654.932f460

[大多数网站无法检测到我,这只是少数几个。我已经尝试了很多“解决方案”,但发布它们最有可能比提供帮助更令人困惑。可能是无头检测,但我不确定。谁可以在这里帮助我?

谢谢你。

selenium webdriver detection tor brute-force
1个回答
0
投票

在此处可以找到通过TOR访问时被阻止的所有网站的完整列表:https://trac.torproject.org/projects/tor/wiki/org/doc/ListOfServicesBlockingTor在此处可以找到临时解决方案来避免涉及通过其他网站获取内容的阻止。

出于安全原因,我已切换到autoVPN(在vmware中的linux中),它是免费的,不受目标网站的阻止,并提供高端隐私。

© www.soinside.com 2019 - 2024. All rights reserved.