使用DDoS防护解析网站



我已经阅读了大量关于使用硒和chromedriver的信息。没有任何帮助。

然后我尝试了未检测到的彩色打印机:

import undetected_chromedriver as uc
url = "<url>"
driver = uc.Chrome()
driver.get(url)
driver.quit()

然而,有这样一个错误:

urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)>

为了避免这一错误,网上的引导人员也于事无补。

也许只有一种方法可以让代码等待5秒,直到浏览器签入过程?

好吧,我使用Grap方法而不是请求
现在它工作了。我认为有绕过的方法。

Grap文件:https://grab.readthedocs.io/en/latest/

因此,您需要安装一个名为beautifulsoup4和requests的库。
pip install beautifulsoup4
pip install requests
之后,试试这个代码:

from bs4 import BeautifulSoup
import requests
html = requests.get("your url here").text
soup = BeautifulSoup(html, 'html.parser')
print(soup)
#use this to try to find elements:
#find_text = soup.find('pre', {'class': 'brush: python; title: ; notranslate'}).get_text()

以下是美容组的文档:https://www.crummy.com/software/BeautifulSoup/bs4/doc/

最新更新