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

Youtube - ssl: certificate_verify_failed #4896

Closed
tremd opened this issue Feb 8, 2015 · 14 comments
Closed

Youtube - ssl: certificate_verify_failed #4896

tremd opened this issue Feb 8, 2015 · 14 comments

Comments

@tremd
Copy link

@tremd tremd commented Feb 8, 2015

python youtube-dl --verbose https://www.youtube.com/watch?v=wnuCSmqC7tI

[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['--verbose', 'https://www.youtube.com/watch?v=wnuCSm
qC7tI']
[debug] Encodings: locale cp1252, fs mbcs, out cp850, pref cp1252
[debug] youtube-dl version 2015.02.06
[debug] Python version 2.7.9 - Windows-7-6.1.7601-SP1
[debug] exe versions: none
[debug] Proxy map: {}
[youtube] wnuCSmqC7tI: Downloading webpage
ERROR: Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILE
D] certificate verify failed (_ssl.c:581)> (caused by URLError(SSLError(1, u'[SS
L: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)'),))
File "youtube-dl\youtube_dl\extractor\common.py", line 301, in _request_webpag
e
return self._downloader.urlopen(url_or_request)
File "youtube-dl\youtube_dl\YoutubeDL.py", line 1578, in urlopen
return self._opener.open(req, timeout=self._socket_timeout)
File "C:\Python27\lib\urllib2.py", line 431, in open
response = self._open(req, data)
File "C:\Python27\lib\urllib2.py", line 449, in _open
'_open', req)
File "C:\Python27\lib\urllib2.py", line 409, in _call_chain
result = func(_args)
File "youtube-dl\youtube_dl\utils.py", line 665, in https_open
req, *_kwargs)
File "C:\Python27\lib\urllib2.py", line 1197, in do_open
raise URLError(err)

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Feb 8, 2015

Can you check if it works with the --no-check-certificate option?

@tremd
Copy link
Author

@tremd tremd commented Feb 8, 2015

It works. But why windows certificate verify failed?

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Feb 8, 2015

We'll have to investigate the issue, using that option is a workaround (unsafe of course).

@tremd
Copy link
Author

@tremd tremd commented Feb 8, 2015

Is it only me?

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Feb 8, 2015

It works for me on windows both with python 2.7.9 and 3.4.2

@tremd
Copy link
Author

@tremd tremd commented Feb 8, 2015

I try python 2.7.8 and i don't get the error.

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Feb 8, 2015

But 2.7.8 can't verify the certificates, so it's the same as using the --no-check-certificate option. Are you willing to run youtube-dl from the source code with a small change to check if it loads the certificates?

@tremd
Copy link
Author

@tremd tremd commented Feb 12, 2015

i didn't know that.

so this is a windows/python problem cause of my configuration.
i think the problem is "windows function activate/deactivate" under system control.
i removed the IE complete.

python request something from ie to verify ssl?
without removing IE in a vm (win7) all seems fine.

I should close this issue, but I want to hear some opinions.

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Feb 14, 2015

I don't really know, I think it uses the system certificates but I don't know how it gets them.

@siso
Copy link

@siso siso commented Apr 26, 2015

I get the same error on FreeBSD, Python 2.7.9, and youtube-dl==2015.4.17:

<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)'),))

Unfortunately --no-check-certificate does not work for me.

It seems to be an issue with old SSH certificates, and as pointed out in #4807, the following does the trick for me:

# pkg update ca_root_nss
export SSL_CERT_FILE=/usr/local/share/certs/ca-root-nss.crt
@Sevyls
Copy link

@Sevyls Sevyls commented Jun 17, 2015

got the same error on OS X 10.10:

$ youtube-dl -F --verbose https://www.youtube.com/watch?v=#####
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-F', u'--verbose', u'https://www.youtube.com/watch?v=#####']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2015.06.15
[debug] Python version 2.7.9 - Darwin-14.3.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 2.2.3
[debug] Proxy map: {}
[youtube] #####: 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)'),))
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 312, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1730, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/usr/local/bin/youtube-dl/youtube_dl/utils.py", line 713, in https_open
    req, **kwargs)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1197, in do_open
    raise URLError(err)
@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Jun 17, 2015

@Sevyls that's not an issue with youtube-dl, it's caused by the openssl installed with Homebrew. Try with the solutions listed in these comments: #5317 (comment) and #5317 (comment).

@akiraaisha
Copy link

@akiraaisha akiraaisha commented Oct 10, 2017

This works on me in Windows. Clearing SSL Cache. Hope it helps.
Internet Options->Content->Clear SSL State

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Oct 12, 2017

Thanks for the tip! I believe it can help others, so I copied it to #7309, which is the main issue for certificate errors on Windows. If you have any further findings, just leave comments there.

@yan12125 yan12125 closed this Oct 12, 2017
@ytdl-org ytdl-org locked and limited conversation to collaborators Oct 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.