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 error #8961

Closed
thany opened this issue Mar 24, 2016 · 21 comments
Closed

SSL error #8961

thany opened this issue Mar 24, 2016 · 21 comments

Comments

@thany
Copy link

@thany thany commented Mar 24, 2016

Just downloaded a fresh copy 5 minutes ago, tried it with a simple command like this:

youtube-dl https://www.youtube.com/watch?v=NK6B6WjHC68

And there ya go:

[youtube] NK6B6WjHC68: Downloading webpage
ERROR: Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)> (caused by URLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)'),))

That's on Windows 10. All my browsers can open the url perfectly fine without warnings or anything.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Mar 24, 2016

Possibly duplicate of #7309. Could you try the solution at #7309 (comment)?

@thany
Copy link
Author

@thany thany commented Mar 24, 2016

Tried to no avail. In my cert store, I don't have any Google/Youtube-related certs at all...

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Mar 24, 2016

Do you have a "GeoTrust Global CA" certificate?

@thany
Copy link
Author

@thany thany commented Mar 24, 2016

Two of them as well, and both expire somewhere in 2022.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Mar 24, 2016

There should be exactly one. Can you check that both have exactly the name "GeoTrust Global CA"?
And, is the start time of the valid interval of the certificate covers your current system time?

@steve5777
Copy link

@steve5777 steve5777 commented Mar 24, 2016

I also have this issue on Linux. New cert file, openssl 1.0.2g, python 2.7.11. I also tried the 2016.03.14 version of youtube-dl, same results. It seems to be a youtube-specific problem, as CBS (Platform) works fine.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Mar 24, 2016

Forgot to ask. Did you use proxies? Post the verbose log with -v:

youtube-dl -v "https://www.youtube.com/watch?v=NK6B6WjHC68"

@steve5777 On Linux SSL certs handling is different from Windows. Please refer to #5225.

@steve5777
Copy link

@steve5777 steve5777 commented Mar 24, 2016

No, I didn't use a proxy. And here's the log. Hope it helps! BTW, with --no-check-certificate it does work fine.

[debug] System config: []
[debug] User config: [u'--continue', u'--restrict-filenames']
[debug] Command-line args: [u'-v', u'https://www.youtube.com/watch?v=NK6B6WjHC68']
[debug] Encodings: locale ANSI_X3.4-1968, fs ANSI_X3.4-1968, out ANSI_X3.4-1968, pref ANSI_X3.4-1968
[debug] youtube-dl version 2016.03.18
[debug] Python version 2.7.11 - Linux-2.4.37-i686-with-slackware-7.1.0
[debug] exe versions: ffmpeg 2.0, rtmpdump 2.4
[debug] Proxy map: {}
ERROR: Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)> (caused by URLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)'),))
File "/usr/bin/youtube-dl/youtube_dl/extractor/common.py", line 365, in _request_webpage
return self._downloader.urlopen(url_or_request)
File "/usr/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1929, in urlopen
return self._opener.open(req, timeout=self._socket_timeout)
File "/usr/lib/python2.7/urllib2.py", line 431, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 449, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(_args)
File "/usr/bin/youtube-dl/youtube_dl/utils.py", line 860, in https_open
req, *_kwargs)
File "/usr/lib/python2.7/urllib2.py", line 1197, in do_open
raise URLError(err)

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Mar 24, 2016

@steve5777 Please open a new issue. Don't mix Linux logs in an issue for Windows.

@steve5777
Copy link

@steve5777 steve5777 commented Mar 31, 2016

OK, sorry about that. In my case, the problem turned out to be a Python update. Apparently all versions since 2.7.9 try to verify certs by default. After much searching, it turns out all I needed to do was set the variable SSL_CERT_FILE to the correct location. No idea if this helps with Windows, though.

@mikaiyl mikaiyl mentioned this issue Apr 1, 2016
0 of 7 tasks complete
@mikaiyl
Copy link

@mikaiyl mikaiyl commented Apr 1, 2016

inb4 update openssl and python Homebrew/legacy-homebrew#38226

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Apr 1, 2016

Don't discuss SSL issues on non-Windows systems in this thread anymore. I'm waiting for @thany's response for what's happening on his/her system. SSL things are quite different on Windows and other systems. Just don't mix them together.

@cc0ut
Copy link

@cc0ut cc0ut commented Apr 1, 2016

Same issue here on window 10 but not with youtube but soundclound

PS > .\youtube-dl.exe -v "https://soundcloud.com/hipsterslovecrazyantics/babymetal-07"
.\youtube-dl.exe : [debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'https://soundcloud.com/hipsterslovecrazyantics/babymetal-07']
[debug] Encodings: locale cp1252, fs mbcs, out None, pref cp1252
[debug] youtube-dl version 2016.03.27
[debug] Python version 2.7.10 - Windows-8-6.2.9200
[debug] exe versions: none
[debug] Proxy map: {}
[soundcloud] hipsterslovecrazyantics/babymetal-07: Resolving id
[soundcloud] hipsterslovecrazyantics/babymetal-07: Downloading info JSON
ERROR: Unable to download JSON metadata: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed 
(_ssl.c:590)> (caused by URLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed 
(_ssl.c:590)'),))
  File "youtube_dl\extractor\common.pyo", line 366, in _request_webpage
  File "youtube_dl\YoutubeDL.pyo", line 1934, in urlopen
  File "urllib2.pyo", line 437, in open
  File "urllib2.pyo", line 550, in http_response
  File "urllib2.pyo", line 469, in error
  File "urllib2.pyo", line 409, in _call_chain
  File "urllib2.pyo", line 656, in http_error_302
  File "urllib2.pyo", line 431, in open
  File "urllib2.pyo", line 449, in _open
  File "urllib2.pyo", line 409, in _call_chain
  File "youtube_dl\utils.pyo", line 864, in https_open
  File "urllib2.pyo", line 1197, in do_open
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Apr 1, 2016

@cc0ut As another reporter said in #9046 (comment): you need to visit https://soundcloud.com/ and https://api.soundcloud.com/ in Internet Explorer or Edge so that Windows will fetch the necessary certificates.
If things are still, check "GlobalSign Root CA" in certmgr.msc.

@cc0ut
Copy link

@cc0ut cc0ut commented Apr 1, 2016

That works.
Btw, I had no problem downloading video from youtube or vimeo despite never having opened the those sites in edge (only in firefox)

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Apr 1, 2016

Two possibilities:

  • As Adam Goodman said in http://bugs.python.org/issue20916, Microsoft pre-installs some certificates. The one YouTube uses (GeoTrust Global CA) and the one Vimeo uses (DigiCert Global Root CA) may already be included.
  • A root CA issues certificates to many websites. Visiting any of them in IE/Edge brings necessary root CA certificates.

I believe @thany is also a victim of Microsoft's new policy. If anyone gets the same error, feel free to open a new issue or leave comments here.

@yan12125 yan12125 closed this Apr 1, 2016
@kanonji
Copy link

@kanonji kanonji commented Feb 20, 2017

I have got the same error and solved by accessing youtube with IE11.

Error message

PS > youtube-dl.exe "http://www.youtube.com/watch?v=6brejYnhpuc" --verbose
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['http://www.youtube.com/watch?v=6brejYnhpuc', '--verbose']
[debug] Encodings: locale cp932, fs mbcs, out cp932, pref cp932
[debug] youtube-dl version 2017.02.16
[debug] Python version 3.4.4 - Windows-10-10.0.14393
[debug] exe versions: ffmpeg N-83507-g8fa18e0, ffprobe N-83507-g8fa18e0
[debug] Proxy map: {}
[youtube] 6brejYnhpuc: Downloading webpage
ERROR: Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600
)> (caused by URLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)'),))
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpnd0pf5s_\build\youtube_dl\extractor\common.py", lin
e 416, in _request_webpage
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpnd0pf5s_\build\youtube_dl\YoutubeDL.py", line 2006,
 in urlopen
  File "C:\Python\Python34\lib\urllib\request.py", line 464, in open
  File "C:\Python\Python34\lib\urllib\request.py", line 482, in _open
  File "C:\Python\Python34\lib\urllib\request.py", line 442, in _call_chain
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpnd0pf5s_\build\youtube_dl\utils.py", line 1060, in
https_open
  File "C:\Python\Python34\lib\urllib\request.py", line 1185, in do_open

What I did

  1. Access youtube with Edge.
  2. Try youtube-dl and get error again.
  3. Check GeoTrust Global CA that will be expired at 2022-05-21
  4. Access youtube with IE11
  5. Try youtube-dl and get worked.

Env

  • Windows10 Pro: 1607
  • youtube-dl: 2017.02.16
@thany
Copy link
Author

@thany thany commented Feb 24, 2017

But such a thing shouldn't be necessary, right?

For instance, this cannot be done on a Server Core edition of Windows which doesn't have any GUI. Furthermore, IE11 is a deprecated browser - requiring that, even if only once, feels not right.

Lastly, it's a workaround that seemingly has nothing to do with the script. I mean, why would visiting the site with a deprecated browser magically fix this script? Makes no sense to me.

But good to know there's a workaround. Because that's really what it is :)

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 24, 2017

Here's a follow-up: a pending patch at http://bugs.python.org/issue28747 enables Python the ability to update system certificates, just like IE.

Makes no sense to me

Indeed. Another Microsoft software design with no sense.

@thany
Copy link
Author

@thany thany commented Feb 24, 2017

The workaround, accessing the site with IE11, doesn't work for me on at least one computer I got. Just tried with a freshly downloaded copy of youtube-dl, and on a fully up-to-date Windows 10. I've got Python 2.7.13 installed, does that matter?...

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 24, 2017

Sorry I can't help you more. There are tons of reasons in SSL errors and most of them are beyond my imagination.

If you know how to build Python on Windows, my patch at http://bugs.python.org/issue28182 can give more information for SSL errors.

I've got Python 2.7.13 installed, does that matter?...

Theoretically, no

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.