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

SOCKS error: traceback instead of error message #24148

Open
barsnick opened this issue Feb 26, 2020 · 0 comments
Open

SOCKS error: traceback instead of error message #24148

barsnick opened this issue Feb 26, 2020 · 0 comments

Comments

@barsnick
Copy link

@barsnick barsnick commented Feb 26, 2020

Checklist

  • I'm reporting a broken site support issue
  • I've verified that I'm running youtube-dl version 2020.02.16
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar bug reports including closed ones
  • I've read bugs section in FAQ

Verbose log

[barsnick@goodtimes ~]$ ~/Downloads/youtube-dl --verbose --proxy socks5://213.101.151.4:1080/ -F https://www.svtplay.se/video/25685944/den-sista-sommaren/den-sista-sommaren-sasong-1-klara-ar-fo
rsvunnen
[debug] System config: [u'--prefer-free-formats']
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--verbose', u'--proxy', u'socks5://213.101.151.4:1080/', u'-F', u'https://www.svtplay.se/video/25685944/den-sista-sommaren/den-sista-sommaren-sasong-1-klara-ar-for
svunnen']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.02.16
[debug] Python version 2.7.15 (CPython) - Linux-4.18.19-100.fc27.x86_64-x86_64-with-fedora-27-Twenty_Seven                                                                                      
[debug] exe versions: ffmpeg 4.1, ffprobe 4.1, rtmpdump 2.4
[debug] Proxy map: {u'http': u'socks5://213.101.151.4:1080/', u'https': u'socks5://213.101.151.4:1080/'}                                                                                        
[debug] Using fake IP 78.74.51.32 (SE) as X-Forwarded-For.
[SVTPlay] 25685944: Downloading webpage
Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/barsnick/Downloads/youtube-dl/__main__.py", line 19, in <module>
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/__init__.py", line 474, in main
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/__init__.py", line 464, in _real_main
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/YoutubeDL.py", line 2018, in download
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/YoutubeDL.py", line 796, in extract_info
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/extractor/common.py", line 530, in extract
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/extractor/svt.py", line 204, in _real_extract
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/extractor/common.py", line 794, in _download_webpage
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/extractor/common.py", line 660, in _download_webpage_handle
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/extractor/common.py", line 627, in _request_webpage
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/YoutubeDL.py", line 2237, in urlopen
  File "/usr/lib64/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
  File "/usr/lib64/python2.7/urllib2.py", line 447, in _open
    '_open', req)
  File "/usr/lib64/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/utils.py", line 2728, in https_open
  File "/usr/lib64/python2.7/urllib2.py", line 1197, in do_open
    h.request(req.get_method(), req.get_selector(), req.data, headers)
  File "/usr/lib64/python2.7/httplib.py", line 1042, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib64/python2.7/httplib.py", line 1082, in _send_request
    self.endheaders(body)
  File "/usr/lib64/python2.7/httplib.py", line 1038, in endheaders
    self._send_output(message_body)
  File "/usr/lib64/python2.7/httplib.py", line 882, in _send_output
    self.send(msg)
  File "/usr/lib64/python2.7/httplib.py", line 844, in send
    self.connect()
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/utils.py", line 2694, in connect
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/socks.py", line 270, in connect
    """socksocket([family[, type[, proto]]]) -> socket object
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/socks.py", line 266, in _make_proxy
    _BaseSocket._savenames.append(name)
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/socks.py", line 221, in _setup_socks5
    sock.settimeout(timeout)
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/socks.py", line 192, in _socks5_auth
    before returning the socket object.
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/socks.py", line 131, in _recv_bytes
    SOCKS5_ERRORS = { 0x01: "General SOCKS server failure",
  File "/home/barsnick/Downloads/youtube-dl/youtube_dl/socks.py", line 126, in recvall
    SOCKS4_ERRORS = { 0x5B: "Request rejected or failed",
EOFError: 2 bytes missing

Description

When providing a SOCKS proxy (SOCKS4 or SOCKS5, same issue) which isn't operational, youtube-dl gives a large traceback. It detects the issue (and reason) though, and should be able to emit a more friendly and better readable error message instead.

A "simple"

General SOCKS server failure: Request rejected or failed.

would be much more obvious if not hidden in the traceback.

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