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

Soundcloud JSON - SSL error #12280

Closed
benoon opened this issue Feb 26, 2017 · 9 comments
Closed

Soundcloud JSON - SSL error #12280

benoon opened this issue Feb 26, 2017 · 9 comments
Labels

Comments

@benoon
Copy link

@benoon benoon commented Feb 26, 2017

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

$ youtube-dl -v https://soundcloud.com/anbroski/lil-jon-ft-three-6-mafia-act-a-fool-anbroski-edit
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'https://soundcloud.com/anbroski/lil-jon-ft-three-6-mafia-act-a-fool-anbroski-edit']
[debug] Encodings: locale ISO-8859-1, fs ISO-8859-1, out ISO-8859-1, pref ISO-8859-1
[debug] youtube-dl version 2017.02.24.1
[debug] Python version 2.7.13 - Linux-3.10.23-xxxx-std-ipv6-64-x86_64-with-redhat-5.11-Final
[debug] exe versions: ffmpeg 0.6.5, ffprobe 0.6.5
[debug] Proxy map: {}
[soundcloud] anbroski/lil-jon-ft-three-6-mafia-act-a-fool-anbroski-edit: Resolving id
[soundcloud] anbroski/lil-jon-ft-three-6-mafia-act-a-fool-anbroski-edit: Downloading info JSON
ERROR: Unable to download JSON metadata: <urlopen error [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:661)> (caused by URLError(SSLError(1, u'[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:661)'),))
File "youtube-dl/youtube_dl/extractor/common.py", line 496, in _request_webpage
return self._downloader.urlopen(url_or_request)
File "youtube-dl/youtube_dl/YoutubeDL.py", line 2093, in urlopen
return self._opener.open(req, timeout=self._socket_timeout)
File "/usr/local/lib/python2.7/urllib2.py", line 435, in open
response = meth(req, response)
File "/usr/local/lib/python2.7/urllib2.py", line 548, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/local/lib/python2.7/urllib2.py", line 467, in error
result = self._call_chain(*args)
File "/usr/local/lib/python2.7/urllib2.py", line 407, in _call_chain
result = func(*args)
File "/usr/local/lib/python2.7/urllib2.py", line 654, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "/usr/local/lib/python2.7/urllib2.py", line 429, in open
response = self._open(req, data)
File "/usr/local/lib/python2.7/urllib2.py", line 447, in _open
'_open', req)
File "/usr/local/lib/python2.7/urllib2.py", line 407, in _call_chain
result = func(*args)
File "youtube-dl/youtube_dl/utils.py", line 1082, in https_open
req, **kwargs)
File "/usr/local/lib/python2.7/urllib2.py", line 1198, in do_open
raise URLError(err)


Description of your issue, suggested solution and other information

Stopped working with Soundcloud few days ago.
I was using Python 2.6.8 , then installed 2.7.13 and 3.5.3 to check if its a problem but all versions show same error.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 26, 2017

What's your openssl version?

python2 -c 'import ssl; print(ssl.OPENSSL_VERSION)'
@benoon
Copy link
Author

@benoon benoon commented Feb 26, 2017

python2 -c 'import ssl; print(ssl.OPENSSL_VERSION)'
OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 26, 2017

OK. The reason is that api.soundcloud.com requires an SSL/TLS feature called Server Name Indication (SNI), which is available since openssl 0.9.8f according to Wikipedia. [1] Please upgrade your openssl.

[1] https://en.wikipedia.org/wiki/Server_Name_Indication

@benoon
Copy link
Author

@benoon benoon commented Feb 26, 2017

I checked on my friends machine and is the same with Python 2.7.9 and OpenSSL 1.0.1t 3 May 2016.

youtube-dl -v https://soundcloud.com/anbroski/lil-jon-ft-three-6-mafia-act-a-fool-anbroski-edit
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'https://soundcloud.com/anbroski/lil-jon-ft-three-6-mafia-act-a-fool-anbroski-edit']
[debug] Encodings: locale ANSI_X3.4-1968, fs ANSI_X3.4-1968, out ANSI_X3.4-1968, pref ANSI_X3.4-1968
[debug] youtube-dl version 2017.02.24.1
[debug] Python version 2.7.9 - Linux-4.9.2-armada375-armv7l-with-Debian-8
[debug] exe versions: none
[debug] Proxy map: {}
[soundcloud] anbroski/lil-jon-ft-three-6-mafia-act-a-fool-anbroski-edit: Resolving id
[soundcloud] anbroski/lil-jon-ft-three-6-mafia-act-a-fool-anbroski-edit: Downloading info JSON
ERROR: Unable to download JSON metadata: <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 "youtube-dl/youtube_dl/extractor/common.py", line 496, in _request_webpage
return self._downloader.urlopen(url_or_request)
File "youtube-dl/youtube_dl/YoutubeDL.py", line 2093, in urlopen
return self._opener.open(req, timeout=self._socket_timeout)
File "/usr/lib/python2.7/urllib2.py", line 437, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 550, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 469, in error
result = self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 656, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "/usr/lib/python2.7/urllib2.py", line 431, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 449, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "youtube-dl/youtube_dl/utils.py", line 1082, in https_open
req, **kwargs)
File "/usr/lib/python2.7/urllib2.py", line 1197, in do_open
raise URLError(err)

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 26, 2017

That's a different issue. Does openssl s_client -connect api.soundcloud.com:443 -servername api.soundcloud.com report any error on that Debian machine?

@benoon
Copy link
Author

@benoon benoon commented Feb 26, 2017

CONNECTED(00000003)
---
Certificate chain
 0 s:/OU=Domain Control Validated/CN=*.soundcloud.com
   i:/C=BE/O=GlobalSign nv-sa/CN=GlobalSign Domain Validation CA - SHA256 - G2
 1 s:/C=BE/O=GlobalSign nv-sa/CN=GlobalSign Domain Validation CA - SHA256 - G2
   i:/C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA
 2 s:/C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA
   i:/C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIE/jCCA+agAwIBAgISESHCb+r/819O0qEF6ITKH3hkMA0GCSqGSIb3DQEBCwUA
MGAxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMTYwNAYD
VQQDEy1HbG9iYWxTaWduIERvbWFpbiBWYWxpZGF0aW9uIENBIC0gU0hBMjU2IC0g
RzIwHhcNMTYwMjEwMTAxOTI1WhcNMTgwNTA5MTAwODQ4WjA+MSEwHwYDVQQLExhE
b21haW4gQ29udHJvbCBWYWxpZGF0ZWQxGTAXBgNVBAMMECouc291bmRjbG91ZC5j
b20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDMjYw8PMx3/lQpNaJI
ewJDgjGDp+gTFmuvIKjwsmiGvlyFozjbGVT3Aa7k8UhRe0EpjI0IOr6ATjQkNjZt
2LJzBrsLLoT+dNJsoIUN2Q7ZsrYZEnhZq1xYj5xUcipnhjFV21lAKYhRdoCea92S
Ekf4CZLb2uT1xljBe0ZLqYYKIRNhRn3XVCCWEFyYUYI3oM4pA4dl3fwrFC46WciE
1Yc1T8ot7z2Ucrgrr+7pRSJQ+f5SUg6lCFl1H9tO4HNYdczDObXQ4A8iDEYv90V+
zRV9dULJi5Aq9St3SV6AVWU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-----END CERTIFICATE-----
subject=/OU=Domain Control Validated/CN=*.soundcloud.com
issuer=/C=BE/O=GlobalSign nv-sa/CN=GlobalSign Domain Validation CA - SHA256 - G2
---
No client certificate CA names sent
---
SSL handshake has read 3978 bytes and written 442 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES128-GCM-SHA256
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES128-GCM-SHA256
    Session-ID: 33C9F126C751A8EFE0BA1E7D5C60B33C899A20092CAA8370F58A82CCECC8FF54
    Session-ID-ctx:
    Master-Key: 2E2EFA584EBA83CA7D2259258D29431D2E92BDFB6CAF21B2FF7AABEEE50960690AACFC0E79C4605CB317212E627A60BB
    Key-Arg   : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    TLS session ticket lifetime hint: 10800 (seconds)
    TLS session ticket:
    0000 - 56 ee 22 d5 16 79 52 2e-05 55 e5 d6 73 5c e7 c0   V."..yR..U..s\..
    0010 - c5 28 d1 9c 6a 91 b0 7b-4e c6 71 ec 2e 3f 2f 48   .(..j..{N.q..?/H
    0020 - 0a d3 bc 0b 47 ec 06 82-44 49 97 d2 40 4f 2d 42   ....G...DI..@O-B
    0030 - d9 02 86 6e 78 d8 5a 20-5a fa 98 87 ca d6 af 10   ...nx.Z Z.......
    0040 - f3 b9 1c e6 bc 0d fe 1b-85 24 1b 25 62 05 44 d5   .........$.%b.D.
    0050 - e5 b1 d4 50 b0 23 9a f3-84 0f 74 68 d5 24 3f 33   ...P.#....th.$?3
    0060 - 48 d6 c2 a9 db a5 6a 76-73 27 81 9a ea b0 0c 2c   H.....jvs'.....,
    0070 - 66 18 15 06 29 ed 55 74-be 62 c3 0a b7 23 4d 90   f...).Ut.b...#M.
    0080 - fd 75 0a 5a be b6 93 9e-78 fc ec 4a d1 18 71 56   .u.Z....x..J..qV
    0090 - 0f 1e e9 e8 65 33 ea 95-f1 86 19 c2 fe 8e ea 8b   ....e3..........
    00a0 - 35 65 fb 06 5e b9 89 2b-8a 49 b5 8d bf 45 d4 8f   5e..^..+.I...E..

    Start Time: 1488123564
    Timeout   : 300 (sec)
    Verify return code: 19 (self signed certificate in certificate chain)
---
closed
@benoon
Copy link
Author

@benoon benoon commented Feb 26, 2017

Sorry I don't know how to format it , 'insert code' gives same..

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Feb 26, 2017

Don't worry. Just use triple backticks.

Seems your system certificate store is broken. A workaround is downloading the latest certificate bundle from https://curl.haxx.se/ca/cacert.pem and set environment variable SSL_CERT_FILE=cacert.pem

@benoon
Copy link
Author

@benoon benoon commented Feb 27, 2017

OK, you wre right, solved, thx.

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