youtube-dl: SSL: CERTIFICATE_VERIFY_FAILED?
$ youtube-dl https://www.youtube.com/watch\?v\=WBsyc139pvA
[youtube] WBsyc139pvA: Downloading webpage
ERROR: Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)> (caused by URLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)'),))
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 27
@blacRose @jaimeMF
Found out the solution, I think it might be the problem of the certs installed by brew’s openssl, they might be expired.
Just force uninstall openssl by
brew remove openssl, thenrm -rf /usr/local/etc/openssl. Finally, reinstall openssl bybrew install openssl, it will reinstall the certs for you, and now youtube-dl should work fine without--no-check-certificateand you don’t have to export the environment variable. Link to the solution: https://github.com/Homebrew/homebrew/issues/38800You guys can also add this solution to README of this project to remind those who have the certificate problem.
--no-check-certificateworks. Thx. But, you can’t fallback to that if it errors?Found a solution:
Manually install ca-cert, then export this cert as an environment variable
A script to install certs: https://gist.github.com/1stvamp/2158128
and then
export SSL_CERT_FILE="/usr/share/curl/ca-bundle.crt"in your.bashrcIf you install openssl with hombrew (it should probably be already installed by wget and python), what happens if you run
export SSL_CERT_FILE=/usr/local/etc/openssl/cert.pemfirst?This solved the problem for me, thank you!
This can also happen if you have something set as your
LD_LIBRARY_PATH.For example exporting plex’s lib path…
Causes similar errors. Sorry to bounce up an old bug, couldn’t find a useful place to put this as it may be helpful for someone else.