pypeteer第一次运行安装chromium
错误:
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)
所以,DOWNLOADS_FOLDER 和 REVISION都是读取对应环境变量设置好的值,如果没有设置,就使用默认值。我们来输出一下,看看默认值:
import pyppeteer.chromium_downloader
print('默认版本是:{}'.format(pyppeteer.__chromium_revision__))
print('可执行文件默认路径:{}'.format(pyppeteer.chromium_downloader.chromiumExecutable.get('mac')))
print('mac平台下载链接为:{}'.format(pyppeteer.chromium_downloader.downloadURLs.get('mac')))
解决方案:
1、设置环境变量:
PYPPETEER_DOWNLOAD_HOST=https://npm.taobao.org/mirrors;
PYTHONHTTPSVERIFY=0
2、手动从https://npm.taobao.org/mirrors/chromium-browser-snapshots/下载后放到 ~/Library/Application Support/pyppeteer/local-chromium/575458/chrome-mac/目录下
参考:
python3安装pyppeteer+chromium及简单实例
网络爬虫之使用pyppeteer替代selenium完美绕过webdriver检测
How to fix Python SSL CERTIFICATE_VERIFY_FAILED