Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL: CERTIFICATE_VERIFY_FAILED error #97

Open
adampalli opened this issue Mar 1, 2024 · 2 comments
Open

SSL: CERTIFICATE_VERIFY_FAILED error #97

adampalli opened this issue Mar 1, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@adampalli
Copy link

Installation method:
pip

Version:
Python 3.12.2 and audiobook-dl 0.7.3

Describe the bug
While downloading some of the audiobooks, I get urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1000)> error.

Command output
Command: audiobook-dl https://www.everand.com/audiobook/681807789/In-the-Middle-of-Middle-America-The-America-Trilogy-Book-1 --debug

Output:

DEBUG audiobook-dl 0.7.3
DEBUG python 3.12.2 (tags/v3.12.2:6abddd9, Feb 6 2024, 21:26:36) [MSC v.1937 64 bit (AMD64)]
INFO Finding compatible source
INFO Authenticating with everand
DEBUG Loading cookies from './cookies.txt'
DEBUG Downloading result of
https://www.everand.com/audiobook/681807789/In-the-Middle-of-Middle-America-The-America-Trilogy-Book-1
DEBUG metadata={'id': 681807789, 'canonical_doc_id': None, 'title': 'In the Middle of Middle America: The America
Trilogy Book 1', 'cover_url':
'https://imgv2-1-f.scribdassets.com/img/audiobook_square_badge/681807789/original/368x368/4ec8f81876/1707741264?v=1',
'cover_url_retina':
'https://imgv2-1-f.scribdassets.com/img/audiobook_square_badge/681807789/original/736x736/de173681fe/1707741264?v=1',
'url': 'https://www.everand.com/audiobook/681807789/In-the-Middle-of-Middle-America-The-America-Trilogy-Book-1',
'document_type': 'audiobook', 'is_snapshot': False, 'author': {'url':
'https://www.everand.com/author/665461497/David-B-Lyons', 'name': 'David B. Lyons'}, 'narrators': [{'name': 'Andy
Ingalls', 'url': 'https://www.everand.com/contributor/709693541/Andy-Ingalls'}, {'name': 'Aoife McMahon', 'url':
'https://www.everand.com/contributor/711058261/Aoife-McMahon'}, {'name': 'Lyssa Browne', 'url':
'https://www.everand.com/contributor/665435133/Lyssa-Browne'}]}
DEBUG csrf={'csrf_token': [Redacted]}
Traceback (most recent call last):
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 1344, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1331, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1377, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1326, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1085, in _send_output
self.send(msg)
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1029, in send
self.connect()
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\http\client.py", line 1472, in connect
self.sock = self._context.wrap_socket(self.sock,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\ssl.py", line 455, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\ssl.py", line 1042, in _create
self.do_handshake()
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\ssl.py", line 1320, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1000)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Scripts\audiobook-dl.exe_main
.py", line 7, in
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\site-packages\audiobookdl_main
.py", line 31, in main
process_url(url, options, config)
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\site-packages\audiobookdl_main_.py", line 54, in process_url
result = source.download(url)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\site-packages\audiobookdl\sources\everand.py", line 24, in download
return self.download_book_from_url(url)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\site-packages\audiobookdl\sources\everand.py", line 78, in download_book_from_url
files = self.get_files(book_info),
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\site-packages\audiobookdl\sources\everand.py", line 105, in get_files
return self.get_internal_files(book_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\site-packages\audiobookdl\sources\everand.py", line 119, in get_internal_files
return self.get_stream_files(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\site-packages\audiobookdl\sources\source\networking.py", line 50, in get_stream_files
playlist = m3u8.load(url, headers=headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\site-packages\m3u8_init_.py", line 94, in load
content, base_uri = http_client.download(uri, timeout, headers, verify_ssl)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\site-packages\m3u8\httpclient.py", line 16, in download
resource = opener.open(uri, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 515, in open
response = self._open(req, data)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 532, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 492, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 1392, in https_open
return self.do_open(http.client.HTTPSConnection, req,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tripl\AppData\Local\Programs\Python\Python312\Lib\urllib\request.py", line 1347, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1000)>

@adampalli adampalli added the bug Something isn't working label Mar 1, 2024
@nianhbg
Copy link

nianhbg commented Jun 21, 2024

@ManoloZocco
Copy link

Python uses a bundle of trusted certificates to verify SSL connections. If your certificate bundle is outdated, you may encounter this error.
Try with:
pip install --upgrade certifi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants