Youtubedl CERTIFICATE_VERIFY_FAILED

Question:

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?

Asked By: user12867493

||

Answers:

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

youtube-dl --no-check-certificate

This option was renamed to --no-check-certificates starting with version 2021.10.09 (inclusive).

Answered By: nt4
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.