Youtubedl CERTIFICATE_VERIFY_FAILED

Xnero picture Xnero · Feb 10, 2020 · Viewed 14.2k times · Source

I ran this code in Python:

from __future__ import unicode_literals
import youtube_dl


ydl_opts = {
    'format': 'bestaudio/best',
    'postprocessors': [{
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'mp3',
        'preferredquality': '192',
    }],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download(['YOUTUBE URL'])

I was hoping it would convert the Youtube video to a URL file.

I got a really long error which basically repeated this:

[0;31mERROR:[0m Unable to download webpage: (caused by URLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)')))

I have searched online but a unsure on how to solve this problem?

Answer

nt4 picture nt4 · Feb 10, 2020

Add the no-check-certificate parameter to the command:

youtube-dl --no-check-certificate