解决Unsupported scheme: b''
网上的教程,配置start_request也好,middlewares也好,
统统不管用,
找到使用scrapy.Request的地方(继续请求or下载)
scrapy.Request(url=url,meta=meta,callback=callback,headers=headers)
修改如下:
def proxyRequest(url,meta,callback,headers={}):
meta["proxy"] = proxyServer
headers["Authorization"] = proxyAuth
return scrapy.Request(url=url,meta=meta,callback=callback,headers=headers)
proxyAuth是代理池服务商给的key,
proxyServer,一定要写协议头 http://
或者https://
这里坑了很久
服务商给的示例代码都没有加http://
,也是服气
报错也很奇怪:Unsupported scheme: b''
因为打印出来的meta里面开头多了个b''