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

Problem with ssl on some youtube servers #2540

Open
tomontherun opened this issue Mar 10, 2014 · 3 comments
Open

Problem with ssl on some youtube servers #2540

tomontherun opened this issue Mar 10, 2014 · 3 comments

Comments

@tomontherun
Copy link

@tomontherun tomontherun commented Mar 10, 2014

Hi,
there seems to be a problem with ssl on some youtube servers.
Test command: python youtube-dl -vv -f 137+140 https://www.youtube.com/watch?v=eDeKetrM5Wc

In country A this gives me:

[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-vv', '-f', '137+140', 'https://www.youtube.com/watch?v=eDeKetrM5Wc']
[debug] Encodings: locale 'cp1252', fs 'mbcs', out 'cp850', pref: 'cp1252'
[debug] youtube-dl version 2014.03.10
[debug] Python version 2.7.2 - Windows-7-6.1.7601-SP1
[debug] Proxy map: {}
[youtube] Setting language
WARNING: unable to set language: <urlopen error [Errno 1] _ssl.c:503: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO
:unknown protocol>
[youtube] eDeKetrM5Wc: Downloading webpage
ERROR: Unable to download webpage: <urlopen error [Errno 1] _ssl.c:503: error:140770FC:SSL routines:SSL23_GET_SERVER_HEL
LO:unknown protocol>
  File "youtube-dl\youtube_dl\extractor\common.py", line 195, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "youtube-dl\youtube_dl\YoutubeDL.py", line 1170, in urlopen
    return self._opener.open(req)
  File "C:\Program Files (x86)\Python27\lib\urllib2.py", line 394, in open
    response = self._open(req, data)
  File "C:\Program Files (x86)\Python27\lib\urllib2.py", line 412, in _open
    '_open', req)
  File "C:\Program Files (x86)\Python27\lib\urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "youtube-dl\youtube_dl\utils.py", line 578, in https_open
    return self.do_open(HTTPSConnectionV3, req)
  File "C:\Program Files (x86)\Python27\lib\urllib2.py", line 1174, in do_open
    raise URLError(err)

But works perfectly fine in country B on an identical system.

DNS Lookup country A:

Name:    youtube.com
Addresses:
          188.21.9.21
          188.21.9.22
          188.21.9.23
          188.21.9.24
          188.21.9.25
          188.21.9.26
          188.21.9.27
          188.21.9.20

DNS Lookup country B:

Name:    youtube.com
Addresses:
173.194.113.39
173.194.113.40
173.194.113.41
173.194.113.46
173.194.113.32
173.194.113.33
173.194.113.34
173.194.113.35
173.194.113.36
173.194.113.37
173.194.113.38

It doesn't make any difference if I use the video link with https or http.
Any ideas?
Thanks

@phihag
Copy link
Contributor

@phihag phihag commented Mar 11, 2014

The 188.21.9.* servers look like valid YouTube servers, they're just on the premises of Telekom Austria. Can you describe that network a little bit more? Is it mobile? Is it a corporate network where a transparent proxy could be in between all traffic? In any case, it looks like the remote end is misconfigured to not support SSL (we always pick HTTPS for all intermediate URLs).

Can you post the output you get when you surf to http://youtube.com:443/ (or, if you're technically inclined: what do you get for curl -i http://www.youtube.com:443/)? That should generate an error, but my guess is that whatever is meddling with the connection is always speaking HTTP, even on port 443. What does your webbrowser say when you surf to https://youtube.com/ ?

We'll consider adding a switch to prefer HTTP over HTTPS, but what you're seeing is really the fault of the proxy.

@tomontherun
Copy link
Author

@tomontherun tomontherun commented Mar 11, 2014

Thanks for your comment.
Telekom Austria is the provider in this case (it's a normal DSL connection), but the 188.31.9.* servers are also returned if I ask the Google DNS server (8.8.8.8) so they seem to be the official youtube servers for this network/area.

curl -vi http://www.youtube.com:443
* About to connect() to www.youtube.com port 443 (#0)
*   Trying 188.21.9.52... connected
* Connected to www.youtube.com (188.21.9.52) port 443 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
> Host: www.youtube.com:443
> Accept: */*
>
* Empty reply from server
* Connection #0 to host www.youtube.com left intact
curl: (52) Empty reply from server
* Closing connection #0

Also gives me an error in the browser.
https://www.youtube.com works fine.

I will probably meddle with my DNS server to return a different IP for Youtube.

@ivan
Copy link
Contributor

@ivan ivan commented Mar 12, 2014

This is probably a dupe of #2219

Try upgrading your Python.

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
3 participants
You can’t perform that action at this time.