lzyzsere 2016-04-21 16:33 采纳率: 0%
浏览 2794

python3 爬取https指向的图片链接 问题

初学python爬虫部分,昨天动手做了做爬取网页图片并且下载的小程序。
发现网页中有的图片可以被下载并且保存在本地,有的却不能。
查看了下网页代码原来可以被爬取的是

而不能被爬取的是
用urllib包好像处理不了

请问如何解决

附上程序报错提示
Traceback (most recent call last):
File "D:\Python34\lib\urllib\request.py", line 1182, in do_open
h.request(req.get_method(), req.selector, req.data, headers)
File "D:\Python34\lib\http\client.py", line 1088, in request
self._send_request(method, url, body, headers)
File "D:\Python34\lib\http\client.py", line 1126, in send_request
self.endheaders(body)
File "D:\Python34\lib\http\client.py", line 1084, in endheaders
self._send_output(message_body)
File "D:\Python34\lib\http\client.py", line 922, in _send_output
self.send(msg)
File "D:\Python34\lib\http\client.py", line 857, in send
self.connect()
File "D:\Python34\lib\http\client.py", line 1231, in connect
server_hostname=server_hostname)
File "D:\Python34\lib\ssl.py", line 365, in wrap_socket
_context=self)
File "D:\Python34\lib\ssl.py", line 583, in __init
_
self.do_handshake()
File "D:\Python34\lib\ssl.py", line 810, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\py_practice\pachong_rumen_1024.py", line 45, in
bytes = urllib.request.urlopen(url);
File "D:\Python34\lib\urllib\request.py", line 161, in urlopen
return opener.open(url, data, timeout)
File "D:\Python34\lib\urllib\request.py", line 463, in open
response = self._open(req, data)
File "D:\Python34\lib\urllib\request.py", line 481, in _open
'_open', req)
File "D:\Python34\lib\urllib\request.py", line 441, in _call_chain
result = func(*args)
File "D:\Python34\lib\urllib\request.py", line 1225, in https_open
context=self._context, check_hostname=self._check_hostname)
File "D:\Python34\lib\urllib\request.py", line 1184, in do_open
raise URLError(err)
urllib.error.URLError:

  • 写回答

3条回答

  • lzyzsere 2016-04-21 16:37
    关注

    ```可以被爬取的是
    不可以被爬取的是

    
    
    
    
    评论

报告相同问题?

悬赏问题

  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 spring后端vue前端
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题