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

`youtube-dl -U` fails to update on outdated machines due to SSL protocol version - consider using http fallback #15497

Closed
cousteaulecommandant opened this issue Feb 4, 2018 · 23 comments
Labels

Comments

@cousteaulecommandant
Copy link

@cousteaulecommandant cousteaulecommandant commented Feb 4, 2018

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like this: [x])
  • Use the Preview tab to see what your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2018.02.04. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2018.02.04yes, after I updated youtube-dl manually (downloading it rather than using the -U option)

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections — yes, my issue is not listed
  • Searched the bugtracker for similar issues including closed ones — only similar bug is #14610, which does not provide enough details to ensure it is the same bug
  • Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser — well, I checked that I can download https://rg3.github.io/youtube-dl/update/LATEST_VERSION using Firefox, so it's not a network issue. I also tried to wget that page as http rather than https and it worked.

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output:

$ sudo youtube-dl -U -v
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-U', u'-v']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.02.04
[debug] Python version 2.6.6 (CPython) - Linux-2.6.35-32-generic-x86_64-with-Ubuntu-10.10-maverick
[debug] exe versions: ffmpeg 0.6-4, ffprobe 0.6-4, rtmpdump 2.3
[debug] Proxy map: {}
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/update.py", line 45, in update_self
    newversion = opener.open(VERSION_URL).read().decode('utf-8').strip()
  File "/usr/lib/python2.6/urllib2.py", line 391, in open
    response = self._open(req, data)
  File "/usr/lib/python2.6/urllib2.py", line 409, in _open
    '_open', req)
  File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "/usr/local/bin/youtube-dl/youtube_dl/utils.py", line 1089, in https_open
    req, **kwargs)
  File "/usr/lib/python2.6/urllib2.py", line 1145, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 1] _ssl.c:490: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version>

ERROR: can't find the current version. Please try again later.

(NB: I also tried running youtube-dl under python 2.7.0 and 3.1.2 without success.)


Description of your issue, suggested solution and other information

I have a rather old computer with a rather out-of-date system, and since recently I can't update youtube-dl. This might be due to github.io changing its SSL protocol and requiring a more advanced standard that my PC has trouble with. (This is partly due to the fix for bug #5909 which required https for the update, although this was working before (up to 2017.12.14) so I guess it has to do with github and not youtube-dl.)

I can think of 3 solutions (assuming the SSL protocols cannot or shall not be changed):

  1. Automatically fall back to http if https fails, possibly prompting the user if they want to use the insecure http instead of https.
  2. Make the user explicitly allow http fallback via a convoluted command line option, like --update-http or -U --allow-http-update, to ensure they know what they're doing. (Additionally, detect if this was an SSL error and in that case tell the user to use this option, rather than showing that "try again later" message.)
  3. Do nothing and just yell at the user for having an outdated system. (Consider providing or linking to instructions for manual download.)

(It should be noted that if someone is affected by this, these solutions will not be effective unless they reinstall manually.)

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 5, 2018

I prefer 1 or 2. As the updater function already checks RSA signatures, so using unencrypted HTTP is not a big problem.

By the way, I think it's time to move away from RSA 1024.

Side notes:

  1. Github is now TLS 1.2 only [1]. It's a configuration accident [2] (earlier than announced). Sooner or later, anyway.
  2. It also affects people on modern systems #15474

[1] https://www.ssllabs.com/ssltest/analyze.html?d=rg3.github.io&s=151.101.53.147
[2] https://githubengineering.com/crypto-removal-notice/

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Feb 5, 2018

There is already --prefer-insecure that just should be respected while updating.

@Animis09
Copy link

@Animis09 Animis09 commented Feb 6, 2018

I have the same problem on my debian server

urllib.error.URLError: <urlopen error [Errno 1] _ssl.c:392: error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version>

@PacoH
Copy link

@PacoH PacoH commented Feb 6, 2018

I had the same problem. I even reinstalled openssl to insure it was properly installed and in my path. Didn't work.
I was finally able to upgrade youtube-dl with brew:

brew upgrade youtube-dl
youtube-dl --version
2018.02.04

It works beautifully.

Here's the output of a 4k video, using highest audio and video:

u=https://youtu.be/2MpUj-Aua48
open -a XRG.app;time(youtube-dl -v -i -f $q --no-mtime --no-playlist --write-sub --sub-lang "en" --embed-subs -o "%(title)s.%(ext)s" "$u");success.sh
[download] Destination: 4K Video Relaxing   Ultra HD TV Test 2160p 20 minutes.f313.webm
[download] 100% of 2.89GiB in 03:09
[download] Destination: 4K Video Relaxing   Ultra HD TV Test 2160p 20 minutes.f251.webm
[download] 100% of 25.99MiB in 00:03
[ffmpeg] Merging formats into "4K Video Relaxing   Ultra HD TV Test 2160p 20 minutes.webm"
[debug] ffmpeg command line: ffmpeg -y -i 'file:4K Video Relaxing   Ultra HD TV Test 2160p 20 minutes.f313.webm' -i 'file:4K Video Relaxing   Ultra HD TV Test 2160p 20 minutes.f251.webm' -c copy -map '0:v:0' -map '1:a:0' 'file:4K Video Relaxing   Ultra HD TV Test 2160p 20 minutes.temp.webm'
real	5m53.525s
4K Video Relaxing   Ultra HD TV Test 2160p 20 minutes.webm
3.13GB
@cousteaulecommandant
Copy link
Author

@cousteaulecommandant cousteaulecommandant commented Feb 7, 2018

@dstftw

There is already --prefer-insecure that just should be respected while updating.

Might do; although I would also add a message telling the user to do that whenever https fails.

@PacoH
Copy link

@PacoH PacoH commented Feb 7, 2018

--prefer-insecure does not work. I tried it. From man page:

--prefer-insecure
  Use an unencrypted connection to retrieve information about the video.  (Currently supported only for
  YouTube)
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Feb 7, 2018

@PacoH did your even read my post? It's not respected currently.

@PacoH
Copy link

@PacoH PacoH commented Feb 7, 2018

You mean There is already --prefer-insecure that just should be respected while updating., which implied that it SHOULD work for updates? I did, and I also just stated that it didn't work, and why. Now you're saying It's not respected currently.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Feb 7, 2018

just should be respected != is respected.

@PacoH
Copy link

@PacoH PacoH commented Feb 7, 2018

It sounded like you were making a recommendation to use --prefer-insecure with youtube-dl -U. And why would it be respected while updating when that is not at all it's intent, as stated in the man page?

@artphotodude
Copy link

@artphotodude artphotodude commented Feb 18, 2018

Was any work-around ever settled-on? Is really a drag to have to check this every week for an update.

@dstftw dstftw closed this in 7d2b4aa Feb 18, 2018
@PacoH
Copy link

@PacoH PacoH commented Feb 18, 2018

I don't know why this is closed. The issue still persists with version 2018.02.04 as installed with brew. Though it can be upgraded with brew, the versions always lag behind the current version.

$ brew info youtube-dl
youtube-dl: stable 2018.02.04

Current version:

$ youtube-dl --version
2018.02.11

I installed the latest version with pip:

sudo pip install --upgrade youtube_dl

This installs it if it isn't already installed, and updates it after that. The -U option does not work:

$ sudo youtube-dl -U
Password:
It looks like you installed youtube-dl with a package manager, pip, setup.py or a tarball. Please use that to update.
@cousteaulecommandant
Copy link
Author

@cousteaulecommandant cousteaulecommandant commented Feb 18, 2018

@PacoH: Commit 7d2b4aa fixes this issue by adding support for the --prefer-insecure option, but it's not available yet (latest "stable" version is still 2018.02.11).
You can download the latest youtube-dl development version and see if it works:

$ git clone https://github.com/rg3/youtube-dl.git --depth 1
$ cd youtube-dl
$ make youtube-dl
$ ./youtube-dl --version
2018.02.11
$ ./youtube-dl -U
ERROR: can't find the current version. Please try again later.
$ ./youtube-dl -U --prefer-insecure
youtube-dl is up-to-date (2018.02.11)
$ 

I would've preferred something to notify users about this --prefer-insecure option (as well as some extra documentation about the use of this option when upgrading), but at least it works.

@PacoH
Copy link

@PacoH PacoH commented Feb 18, 2018

OK. Thanks. I tried it and it works exactly as advertised. It still seems strange that using --prefer-insecure, which is intended for videos, is necessary though. Is anyone going to fix it so that is not needed? I moved the executable to /usr/local/bin/ so it is in my path. Problem is, there's no man page now.

I downloaded https://youtu.be/9G8btrd6OQg and it was nice and fast.

[download] Destination: Winter Olympics Korea 2018 - Opening Ceremonies Drone Show  オリンピック2018平昌開会式.f136.mp4
[download] 100% of 258.07MiB in 00:22
[download] Destination: Winter Olympics Korea 2018 - Opening Ceremonies Drone Show  オリンピック2018平昌開会式.f140.m4a
[download] 100% of 19.38MiB in 00:01
real	0m51.636s
user	0m9.011s
sys	0m3.428s

screen shot 2018-02-18 at 3 57 51 pm

dstftw added a commit that referenced this issue Feb 27, 2018
This reverts commit 7d2b4aa.
@Woolwit
Copy link

@Woolwit Woolwit commented May 20, 2018

$ youtube-dl -U --prefer-insecure
ERROR: can't find the current version. Please try again later.

@PacoH
Copy link

@PacoH PacoH commented May 20, 2018

This works:

sudo pip install --upgrade youtube_dl

Collecting youtube_dl
  Downloading https://files.pythonhosted.org/packages/dc/a5/3c218e455a9f864f32b5403455bf3bde6967a6aea96ae4d10fb79736f36c/youtube_dl-2018.5.18-py2.py3-none-any.whl (1.7MB)
	100% |████████████████████████████████| 1.7MB 517kB/s 
Installing collected packages: youtube-dl
  Found existing installation: youtube-dl 2018.5.1
	Uninstalling youtube-dl-2018.5.1:
	  Successfully uninstalled youtube-dl-2018.5.1
Successfully installed youtube-dl-2018.5.18
@Woolwit
Copy link

@Woolwit Woolwit commented May 21, 2018

Thanks, I was able to upgrade using brew, but even after updating to 2018.05.18, I get:
$ youtube-dl -U --prefer-insecure
ERROR: can't find the current version. Please try again later.

@PacoH
Copy link

@PacoH PacoH commented May 21, 2018

How did you do that? I tried:

~ $ brew info youtube-dl
youtube-dl: stable 2018.02.04, HEAD
Download YouTube videos from the command-line
https://rg3.github.io/youtube-dl/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/youtube-dl.rb
==> Options
--HEAD
	Install HEAD version
~ $ youtube-dl --version
2018.05.18

I have found that the brew version is often not the latest.

NOTE: I had already updated it using pip.

@canamcy
Copy link

@canamcy canamcy commented May 23, 2018

I'm using Python 3.2 and was having ssl errors due to TLS version.
I found snippets on SO for checking ssl version and TLS version.
Apparently 3.2 is no longer supported by ytdl, so I wrote a snippet for checking and downloading ytdl version.
(--no-check-certificate didn't work)

ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
handler = urllib.request.HTTPSHandler(context=ctx)
opener = urllib.request.build_opener(handler)
urllib.request.install_opener(opener)
url = YT_DL_URL
response = opener.open(url)

@dajare
Copy link

@dajare dajare commented Sep 9, 2018

I had this problem with 2017.12.02 on my MacBook (Yosemite), so manually removed that version of youtube-dl, and installed fresh with the curl method following the instructions on the download page.

But the problem persists. This is what I see:

$ youtube-dl --version
2018.09.10
$ sudo youtube-dl -U --prefer-insecure
ERROR: can't find the current version. Please try again later.

At least I know how to manually update the app now, but it's a shame the -U option isn't available.

@Woolwit
Copy link

@Woolwit Woolwit commented Sep 15, 2018

I'm getting a new error today that is asking me to make a bug report, but also reminding me to make sure I'm using the latest version.
Running $ sudo youtube-dl -U --prefer-insecure results in.
ERROR: can't find the current version. Please try again later.
Updating via Brew got me to:
youtube-dl --version 2018.09.10
At which point the error issue was resolved.
But then...
$ sudo youtube-dl -U --prefer-insecure ERROR: can't find the current version. Please try again later.

@Hrxn
Copy link

@Hrxn Hrxn commented Sep 16, 2018

If you use Homebrew you don't need to update with -U..
(Same with pip)

@rc1717
Copy link

@rc1717 rc1717 commented Sep 25, 2018

I was finally able to upgrade

Heeeeeey thanks to your comment, I got to update from the Nov 2017 version ;) 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.