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

Unable to download ... urlopen error [SSL: CERTIFICATE_VERIFY_FAILED], macOS 13.1, Py3.10 #31747

Closed
RaspChris opened this issue Mar 3, 2023 · 9 comments

Comments

@RaspChris
Copy link

RaspChris commented Mar 3, 2023

Hi,

It seems to me that since upgrade of my system (and youtube-dl) youtube-dl doesn't work (always same message).
Thank you for looking into that.

youtube-dl https://youtu.be/l4Jb73hBtoE -v
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['https://youtu.be/l4Jb73hBtoE', '-v']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Python version 3.10.0 (CPython) - macOS-13.1-arm64-arm-64bit
[debug] exe versions: none
[debug] Proxy map: {}
[youtube] l4Jb73hBtoE: Downloading webpage
WARNING: Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>
[youtube] l4Jb73hBtoE: Downloading API JSON
ERROR: Unable to download API page: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)> (caused by URLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/youtube_dl/extractor/common.py", line 634, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/youtube_dl/YoutubeDL.py", line 2288, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 519, in open
    response = self._open(req, data)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/youtube_dl/utils.py", line 2735, in https_open
    return self.do_open(functools.partial(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1351, in do_open
    raise URLError(err)
@dirkf dirkf added the duplicate label Mar 3, 2023
@dirkf dirkf closed this as completed Mar 3, 2023
@dirkf dirkf removed the duplicate label Mar 3, 2023
@dirkf
Copy link
Contributor

dirkf commented Mar 3, 2023

Work-around: --no-check-certificate (but then, obvs, the certificate is not being checked).

Solution: update the certificates used by your Python installation. Review #31189, also pytube/pytube#241 (comment).

@dirkf dirkf reopened this Mar 3, 2023
@dirkf dirkf changed the title Unable to download [any] webpage/ Unable to download API page Unable to download ... urlopen error [SSL: CERTIFICATE_VERIFY_FAILED], macOS 13.1, Py3.10 Mar 3, 2023
@RaspChris
Copy link
Author

thank you,
I updated pyhton, I updated pip, I updates certificates

I still get the same message from youtube. Sorry

@dirkf
Copy link
Contributor

dirkf commented Mar 6, 2023

It's nothing to do with yt-dl and everything to do with how your Python and OpenSSL are installed on your new macOS. The linked issues provide guidance. Also here.

Otherwise, another work-around is that you can now install Linux on your Mac ...

@PerfyNormal
Copy link

youtube-dl version 2020.11.26 doesn't have this problem but youtube-dl version 2021.12.17 does, and it seems so does the latest versions.
I've tried using python and windows exec, but get the certificate error even with --no-check-certificate unless I use the 2022.11.26 release.

@dirkf
Copy link
Contributor

dirkf commented Mar 17, 2023

Show the verbose logs of these cases.

@ThunderWear2007
Copy link

youtube-dl version 2020.11.26 doesn't have this problem but youtube-dl version 2021.12.17 does, and it seems so does the latest versions. I've tried using python and windows exec, but get the certificate error even with --no-check-certificate unless I use the 2022.11.26 release.

How can we get on the older versions ?

@dirkf
Copy link
Contributor

dirkf commented Mar 27, 2023

They're all on the site, but don't bother unless your aim is to provide these test results as asked.

Show the verbose logs of these cases.

Old versions will fail in numerous other ways, so this is only useful to diagnose if some change in the HTTPS code has had an unexpected result

If you do this, also note and report your installation log for each version, in case there is some issue not shown in the program's verbose log.

I lay odds of 100:1 that this problem is due to the certificate configuration for the version of OpenSSL used by the Python that is running yt-dl being broken. The previously provided links apply.

For a usable yt-dl version, get the git master, or one of the other solutions suggested for #31350.

@dirkf
Copy link
Contributor

dirkf commented Apr 12, 2023

This old issue 5317 has some possibly useful info.

@gh05t5
Copy link

gh05t5 commented Apr 4, 2024

This just happened to me. If you are using iOS, the you have to run the "Install Certificates.command" file that will be in
/Applications/Python 3.9
Make sure to run the script from your terminal with sudo since it will write the certificates in certain files and it needs the proper permissions for it

@dirkf dirkf closed this as not planned Won't fix, can't repro, duplicate, stale Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants