youtube-dl: SSL certificate verify failed

#4807 was diagnosed on FreeBSD. As suggested, I’m reporting the same issue on ArchLinux.

However, I’ve installed youtube-dl through nix, you may want to investigate as if I were running NixOS.

Cc @jaimeMF .

Here is the verbose output:

[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-v', '--no-check-certificate', 'https://www.youtube.com/watch?v=pKzhNZGG1AM']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2015.01.25
[debug] Python version 2.7.9 - Linux-3.18.2-2-ARCH-x86_64-with-glibc2.2.5
[debug] exe versions: ffmpeg 2.5.3, ffprobe 2.5.3, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] pKzhNZGG1AM: Downloading webpage
ERROR: Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)> (caused by URLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)'),))
  File "/home/koral/.nix-profile/bin/youtube-dl/youtube_dl/extractor/common.py", line 299, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "/home/koral/.nix-profile/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1571, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/nix/store/g4zbmgjdg7nd0z1cf3ixas6rxp874zlh-python-2.7.9/lib/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/nix/store/g4zbmgjdg7nd0z1cf3ixas6rxp874zlh-python-2.7.9/lib/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/nix/store/g4zbmgjdg7nd0z1cf3ixas6rxp874zlh-python-2.7.9/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/home/koral/.nix-profile/bin/youtube-dl/youtube_dl/utils.py", line 659, in https_open
    req)
  File "/nix/store/g4zbmgjdg7nd0z1cf3ixas6rxp874zlh-python-2.7.9/lib/python2.7/urllib2.py", line 1197, in do_open
    raise URLError(err)

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 18 (1 by maintainers)

Most upvoted comments

Did you try using ‘–no-check-certificate’ as a temporary workaround?

FYI - to fix this please see https://stackoverflow.com/a/42334357/1896134

This seems to be a problem for 3.6 & 3.7 details listed in the SO answer.

In short, try this

pip3 install certifi Then /Applications/Python\ 3.7/Install\ Certificates.command

Your terminal should look something like this:

$ pip3 install certifi
Collecting certifi
  Using cached https://files.pythonhosted.org/packages/9f/e0/accfc1b56b57e9750eba272e24c4dddeac86852c2bebd1236674d7887e8a/certifi-2018.11.29-py2.py3-none-any.whl
Installing collected packages: certifi
Successfully installed certifi-2018.11.29


$ /Applications/Python\ 3.7/Install\ Certificates.command
 -- pip install --upgrade certifi
Requirement already up-to-date: certifi in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (2018.11.29)
 -- removing any existing file or link
 -- creating symlink to certifi certificate bundle
 -- setting permissions
 -- update complete


After installing python3 and python 2 with nix (on OSX), with the latest version of youtube-dl --no-check-certificate seems to be fixed. If you set and export the variable SSL_CERT_FILE to the path of your CA bundle (if you installed the cacert package, you can use ~/.nix-profile/etc/ca-bundle.crt), the CA certificates are properly loaded and --no-check-certificate is not needed.

I’ve encountered the same problem. Installed youtube-dl with pip3 install youtube-dl

Then got the error when I did : sudo youtube-dl [URL]

ERROR: Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)> (caused by URLError(SSLError [3] Exit 1 sudo youtube-dl https://www.youtube.com/watch?v=19ecwVEvI-0

Fixing the command to sudo youtube-dl --no-check-certificate https://www.youtube.com/watch?v=19ecwVEvI-0&feature=youtu.be&app=desktop solved my problem. I was running the code on Mac OS

FYI - to fix this please see https://stackoverflow.com/a/42334357/1896134

This seems to be a problem for 3.6 & 3.7 details listed in the SO answer.

In short, try this

pip3 install certifi Then /Applications/Python\ 3.7/Install\ Certificates.command

Your terminal should look something like this:

$ pip3 install certifi
Collecting certifi
  Using cached https://files.pythonhosted.org/packages/9f/e0/accfc1b56b57e9750eba272e24c4dddeac86852c2bebd1236674d7887e8a/certifi-2018.11.29-py2.py3-none-any.whl
Installing collected packages: certifi
Successfully installed certifi-2018.11.29


$ /Applications/Python\ 3.7/Install\ Certificates.command
 -- pip install --upgrade certifi
Requirement already up-to-date: certifi in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (2018.11.29)
 -- removing any existing file or link
 -- creating symlink to certifi certificate bundle
 -- setting permissions
 -- update complete

tysm this helped me