批量下载b站视频列表,下载第二个的时候报错:
raise URLError(‘unknown url type: %s’ % type)
urllib.error.URLError: <urlopen error unknown url type: [‘https>
加上—debug,输出的错误信息为:
Traceback (most recent call last):
File "/home/xiongz/anaconda3/bin/you-get", line 11, in <module>
sys.exit(main())
File "/home/xiongz/anaconda3/lib/python3.6/site-packages/you_get/__main__.py", line 92, in main
main(**kwargs)
File "/home/xiongz/anaconda3/lib/python3.6/site-packages/you_get/common.py", line 1831, in main
script_main(any_download, any_download_playlist, **kwargs)
File "/home/xiongz/anaconda3/lib/python3.6/site-packages/you_get/common.py", line 1719, in script_main
**extra
File "/home/xiongz/anaconda3/lib/python3.6/site-packages/you_get/common.py", line 1343, in download_main
download_playlist(url, **kwargs)
File "/home/xiongz/anaconda3/lib/python3.6/site-packages/you_get/common.py", line 1827, in any_download_playlist
m.download_playlist(url, **kwargs)
File "/home/xiongz/anaconda3/lib/python3.6/site-packages/you_get/extractors/bilibili.py", line 620, in download_playlist_by_url
self.__class__().download_by_url(purl, **kwargs)
File "/home/xiongz/anaconda3/lib/python3.6/site-packages/you_get/extractor.py", line 61, in download_by_url
self.download(**kwargs)
File "/home/xiongz/anaconda3/lib/python3.6/site-packages/you_get/extractor.py", line 241, in download
av=stream_id in self.dash_streams)
File "/home/xiongz/anaconda3/lib/python3.6/site-packages/you_get/common.py", line 1024, in download_urls
headers=headers, **kwargs
File "/home/xiongz/anaconda3/lib/python3.6/site-packages/you_get/common.py", line 649, in url_save
chunk_sizes = [url_size(url, faker=faker, headers=tmp_headers) for url in url]
File "/home/xiongz/anaconda3/lib/python3.6/site-packages/you_get/common.py", line 649, in <listcomp>
chunk_sizes = [url_size(url, faker=faker, headers=tmp_headers) for url in url]
File "/home/xiongz/anaconda3/lib/python3.6/site-packages/you_get/common.py", line 533, in url_size
response = urlopen_with_retry(request.Request(url, headers=headers))
File "/home/xiongz/anaconda3/lib/python3.6/site-packages/you_get/common.py", line 408, in urlopen_with_retry
return request.urlopen(*args, **kwargs)
File "/home/xiongz/anaconda3/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/home/xiongz/anaconda3/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/home/xiongz/anaconda3/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/home/xiongz/anaconda3/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/home/xiongz/anaconda3/lib/python3.6/urllib/request.py", line 1361, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/home/xiongz/anaconda3/lib/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)>
解决:
在/home/xiongz/anaconda3/lib/python3.6/site-packages/you_get/__main__.py
里添加代码:
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
就ok了。
python—urllib.error.URLError:certificate verify failed: unable to get local issuer certificat