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.SSLError: unknown error (_ssl.c:638) #5359

Closed
ghost opened this issue Apr 4, 2015 · 5 comments
Closed

ssl.SSLError: unknown error (_ssl.c:638) #5359

ghost opened this issue Apr 4, 2015 · 5 comments

Comments

@ghost
Copy link

@ghost ghost commented Apr 4, 2015

Everything worked properly until I updated youtube-dl to 2015.04.03 with pip install --upgrade youtube-dl. This happens everytime I try to download something.

C:\Windows\system32>youtube-dl -v https://www.youtube.com/watch?v=9bZkp7q19f0
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-v', 'https://www.youtube.com/watch?v=9bZkp7q19f0']

Traceback (most recent call last):
  File "C:\Python34\lib\runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Python34\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python34\Scripts\youtube-dl.exe\__main__.py", line 9, in <module>
  File "C:\Python34\lib\site-packages\youtube_dl\__init__.py", line 408, in main

    _real_main(argv)
  File "C:\Python34\lib\site-packages\youtube_dl\__init__.py", line 375, in _rea
l_main
    with YoutubeDL(ydl_opts) as ydl:
  File "C:\Python34\lib\site-packages\youtube_dl\YoutubeDL.py", line 331, in __i
nit__
    self._setup_opener()
  File "C:\Python34\lib\site-packages\youtube_dl\YoutubeDL.py", line 1775, in _s
etup_opener
    if hasattr(ctx, 'get_ca_certs') and len(ctx.get_ca_certs()) == 0:
ssl.SSLError: unknown error (_ssl.c:638)
@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Apr 4, 2015

I haven't tested it in windows yet. A similar issue has also been reported in the cpython bugtracker, could you try running the test script they posted?

@ghost
Copy link
Author

@ghost ghost commented Apr 4, 2015

Sure, here's the output:

Traceback (most recent call last):
  File "C:\Users\Admin\Desktop\win_ca_test.py", line 8, in <module>
    ca_certs = context.get_ca_certs()
ssl.SSLError: unknown error (_ssl.c:638)
@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Apr 4, 2015

Thanks, could you try the following script?

import ssl

# Load default certificates
context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH)
context.load_default_certs()
stats = context.cert_store_stats()
print('Stats:', stats)
ca_certs = context.get_ca_certs()
print('{} CA Certificates loaded:'.format(len(ca_certs)))
for cert_dict in ca_certs:
    print(cert_dict['subject'])
print()

With the previous version, could YouTube videos be downloaded?

@ghost
Copy link
Author

@ghost ghost commented Apr 5, 2015

Stats: {'x509_ca': 296, 'x509': 298, 'crl': 0}
Traceback (most recent call last):
  File "C:\Users\Admin\Desktop\script.py", line 8, in <module>
    ca_certs = context.get_ca_certs()
ssl.SSLError: unknown error (_ssl.c:638)

I'm not sure which version I was using previously. It was from the second half of march and it downloaded YouTube videos just fine.

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Apr 6, 2015

It will work again in the next version, I have removed that check because of #5364.
Thanks for the report!

@jaimeMF jaimeMF closed this Apr 6, 2015
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
1 participant
You can’t perform that action at this time.