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 certificate verify failed #4816

Closed
k0ral opened this issue Jan 29, 2015 · 18 comments
Closed

SSL certificate verify failed #4816

k0ral opened this issue Jan 29, 2015 · 18 comments

Comments

@k0ral
Copy link

@k0ral k0ral commented Jan 29, 2015

#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)
@arisboch
Copy link

@arisboch arisboch commented Jan 30, 2015

Did you try using '--no-check-certificate' as a temporary workaround?

@k0ral
Copy link
Author

@k0ral k0ral commented Jan 30, 2015

As indicated in the logs above, yes, I've tried using the --no-check-certificate option, in vain.

@phihag
Copy link
Contributor

@phihag phihag commented Jan 30, 2015

Can you retry with youtube-dl 2015.01.30.1 and newer? I believe --no-check-certificate should be fixed in there. Of course, it's quite curious why cert validations fails in the first place.

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Jan 30, 2015

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.

@k0ral
Copy link
Author

@k0ral k0ral commented Jan 31, 2015

I confirm your diagnosis and treatment :) . Thank you.

@k0ral k0ral closed this Jan 31, 2015
@justa9
Copy link

@justa9 justa9 commented Oct 27, 2015

The compiled binaries (32-bit, Windows XP) for the last two versions produce an error when trying to access youtube.

ERROR: Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)> (caused by URLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)'),))

Both official and locally-compiled binaries were tested to no avail.

"--no-check certificate" works as expected, but since it's not recommended, I was wondering whether there was more to that.

Last working compiled version was "2015.10.18".

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Oct 27, 2015

@justa9 Please open a new issue. This problem varies among operating systems so it's considered a different problem.

@jadedh
Copy link

@jadedh jadedh commented Jun 19, 2017

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

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jun 19, 2017

@jadedh: Sounds like #11943 (comment) can help. In general --no-check-certificate is not necessary, and it's not recommended to run youtube-dl with sudo.

@akiraaisha
Copy link

@akiraaisha akiraaisha commented Oct 10, 2017

This works on me in Windows. Clearing SSL Cache. Hope it helps.
Internet Options->Content->Clear SSL State

@adolfintel
Copy link

@adolfintel adolfintel commented Jan 13, 2018

I'm having this issue on Windows 10 when downloading from Youtube. Clearing the SSL cache doesn't help.
I don't know what's the cause. Updating youtube-dl doesn't solve the issue, but it works on my other PC.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jan 13, 2018

Check out #7309 (comment)

@adolfintel
Copy link

@adolfintel adolfintel commented Jan 13, 2018

@yan12125 I have no google certificates

@xingheng
Copy link

@xingheng xingheng commented Jan 11, 2019

@jadedh sudo? Why?

@JayRizzo
Copy link

@JayRizzo JayRizzo commented Jan 20, 2019

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


@bspammer
Copy link

@bspammer bspammer commented Feb 21, 2019

Putting this here for anyone else who's as inattentive as me:

Deactivate your virtual environment

@Shaglock
Copy link

@Shaglock Shaglock commented Mar 7, 2019

$ /Applications/Python\ 2.7/Install\ Certificates.command
This helped me

@ParhaZz
Copy link

@ParhaZz ParhaZz commented Aug 30, 2019

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.