Search code examples
pythonpython-3.xsslssl-certificateyoutube-dl

How to avoid No-SSL-CERTIFICATE error in youtube-dl?


import tkinter
import youtube_dl

ydl_opts = {
    'nocheckcertificate:': True
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download(['https://www.youtube.com/watch?v=C-u5WLJ9Yk4'])

print('done')

Hi , by executing the above code, I am getting

ERROR: Unable to download webpage: (caused by URLError(SSLError(1, '[SSL: CERTIFICAT

How to avoid this error? I am using pycharm3, It's working fine through my mac OS terminal.

For your reference. https://github.com/rg3/youtube-dl/blob/master/README.md#embedding-youtube-dl


Solution

  • The colon is not part of the key, so the options need to be

    ydl_opts = {
        'nocheckcertificate': True,
    } #                   ^^
    

    The error message in your question is incomplete, so I can't tell what the original problem is. Most likely, you are using an some outdated or bad Python distribution without either bundled root CAs or the correct configuration to use the OS' root CA store. Updating pycharm3 may help.