you-get依赖包未安装报错,无法使用


个人开发环境

you-get: version 0.4.915
OpenSSL: 1.0.2g

问题描述

regel@DESKTOP-K146JU9:/mnt/c/Users/user/Downloads$ you-get http://www.fsf.org/blogs/rms/20140407-geneva-tedx-talk-free-software-free-society
you-get: [error] oops, something went wrong.
you-get: don't panic, c'est la vie. please try the following steps:
you-get:   (1) Rule out any network problem.
you-get:   (2) Make sure you-get is up-to-date.
you-get:   (3) Check if the issue is already known, on
you-get:         https://github.com/soimort/you-get/wiki/Known-Bugs
you-get:         https://github.com/soimort/you-get/issues
you-get:   (4) Run the command with '--debug' option,
you-get:       and report this issue with the full output.

you-get error

使用--debug参数,查看 错误信息:

regel@DESKTOP-K146JU9:/mnt/c/Users/user/Downloads$ you-get https://www.youtube.com/watch?v=4BXpi7056RM --debug
[DEBUG] get_content: https://www.youtube.com/get_video_info?video_id=4BXpi7056RM
you-get: version 0.4.915, a tiny downloader that scrapes the web.
you-get: Namespace(URL=['https://www.youtube.com/watch?v=4BXpi7056RM'], cookies=None, debug=True, extractor_proxy=None, force=False, format=None, help=False, http_proxy=None, info=False, input_file=None, itag=None, json=False, no_caption=False, no_merge=False, no_proxy=False, output_dir='.', output_filename=None, password=None, player=None, playlist=False, socks_proxy=None, stream=None, timeout=600, url=False, version=False)
Traceback (most recent call last):
  File "/usr/lib/python3.5/urllib/request.py", line 1254, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
  ...
  File "/usr/lib/python3.5/ssl.py", line 988, in do_handshake
    self._sslobj.do_handshake()
  File "/usr/lib/python3.5/ssl.py", line 633, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:645)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/you-get", line 11, in <module>
    sys.exit(main())
  ...
  File "/usr/lib/python3.5/urllib/request.py", line 1297, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib/python3.5/urllib/request.py", line 1256, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error EOF occurred in violation of protocol (_ssl.c:645)>

解决方法

使用pip3, 安装 pyopenssl,pyasn1 以及ndg-httpsclient 包即可.

regel@DESKTOP-K146JU9:/mnt/c/Users/user/Downloads$ pip3 install pyopenssl
Collecting pyopenssl
  Downloading pyOpenSSL-17.3.0-py2.py3-none-any.whl (51kB)
    100% |████████████████████████████████| 51kB 344kB/s
Requirement already satisfied: six>=1.5.2 in /usr/lib/python3/dist-packages (from pyopenssl)
Collecting cryptography>=1.9 (from pyopenssl)
  Downloading cryptography-2.0.3-cp35-cp35m-manylinux1_x86_64.whl (2.2MB)
    100% |████████████████████████████████| 2.2MB 439kB/s
Requirement already satisfied: asn1crypto>=0.21.0 in /usr/local/lib/python3.5/dist-packages (from cryptography>=1.9->pyopenssl)
Collecting idna>=2.1 (from cryptography>=1.9->pyopenssl)
  Downloading idna-2.6-py2.py3-none-any.whl (56kB)
    100% |████████████████████████████████| 61kB 1.8MB/s
Requirement already satisfied: cffi>=1.7 in /usr/local/lib/python3.5/dist-packages (from cryptography>=1.9->pyopenssl)
Requirement already satisfied: pycparser in /usr/local/lib/python3.5/dist-packages (from cffi>=1.7->cryptography>=1.9->pyopenssl)
Installing collected packages: idna, cryptography, pyopenssl
  Found existing installation: idna 2.0
    Uninstalling idna-2.0:
      Successfully uninstalled idna-2.0
  Found existing installation: cryptography 1.2.3
    Uninstalling cryptography-1.2.3:
      Successfully uninstalled cryptography-1.2.3
Successfully installed cryptography-2.0.3 idna-2.6 pyopenssl-17.3.0

regel@DESKTOP-K146JU9:/mnt/c/Users/user/Downloads$ pip3 install pyasn1
Requirement already satisfied: pyasn1 in /usr/lib/python3/dist-packages

regel@DESKTOP-K146JU9:/mnt/c/Users/user/Downloads$ pip3 install ndg-httpsclient
Collecting ndg-httpsclient
  Downloading ndg_httpsclient-0.4.3-py3-none-any.whl
Requirement already satisfied: pyasn1>=0.1.1 in /usr/lib/python3/dist-packages (from ndg-httpsclient)
Requirement already satisfied: PyOpenSSL in /usr/local/lib/python3.5/dist-packages (from ndg-httpsclient)
Requirement already satisfied: cryptography>=1.9 in /usr/local/lib/python3.5/dist-packages (from PyOpenSSL->ndg-httpsclient)
Requirement already satisfied: six>=1.5.2 in /usr/lib/python3/dist-packages (from PyOpenSSL->ndg-httpsclient)
Requirement already satisfied: idna>=2.1 in /usr/local/lib/python3.5/dist-packages (from cryptography>=1.9->PyOpenSSL->ndg-httpsclient)
Requirement already satisfied: cffi>=1.7 in /usr/local/lib/python3.5/dist-packages (from cryptography>=1.9->PyOpenSSL->ndg-httpsclient)
Requirement already satisfied: asn1crypto>=0.21.0 in /usr/local/lib/python3.5/dist-packages (from cryptography>=1.9->PyOpenSSL->ndg-httpsclient)
Requirement already satisfied: pycparser in /usr/local/lib/python3.5/dist-packages (from cffi>=1.7->cryptography>=1.9->PyOpenSSL->ndg-httpsclient)
Installing collected packages: ndg-httpsclient
Successfully installed ndg-httpsclient-0.4.3

参考文档


Author: Itaken
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source Itaken !
  TOC目录