整理于2020年11月下旬,献给不甘平凡的你
更多企业级爬虫知识请查收于:https://blog.csdn.net/weixin_45316122/article/details/109840745
bug1
NetworkError: Protocol error Runtime.callFunctionOn: Target closed.
解决方法:
1.找到并打开Pyppeteer
的源码里的connection.py
这个文件,看报错信息就能找到。
2.把下面图片中,红色减号
的那条注释掉,新添加绿色加号
那条的代码。
实测解决。。。
bug2
pyppeteer.errors.NetworkError: Request interception is not enabled.
puppeteer 爬虫设置 请求拦截-图片请求
1.首先需要先将 请求拦截 功能开启:
await page.setRequestInterception(true); // 设为true 开启 false 关闭
2.再利用 request 事件 来对请求进行处理(筛选)
page.on('request', interceptedRequest => {
//判断如果是 图片请求 就直接拦截
if (interceptedRequest.url().endsWith('.png') || interceptedRequest.url().endsWith('.jpg'))
interceptedRequest.abort(); //终止请求
else
interceptedRequest.continue();//弹出
});
.....
6.16 bug
pyppeteer.errors.NetworkError: Request interception is not enabled.
问了群里的大佬
1.把websockets库卸载掉,然后再装指定6.0版本的
2.升级pyppeteer库也行,不过升级了有的网站就会被检测到了
大佬这么说的,你websockets没装6的只要有交互就出错
6.17bug
sys:1: RuntimeWarning: coroutine 'Page.goto' was never awaited
AttributeError: 'coroutine' object has no attribute 'status'