rachmadaniHaryono / we-get

:icecream: Command-line tool for searching torrents.
MIT License
153 stars 26 forks source link

Basic Usage instructions not Working #14

Open tlelson opened 5 years ago

tlelson commented 5 years ago

Describe the bug README.md behaviour not replicable.

To Reproduce

  1. Install

    (general) minmac@minmacMBP:~ ❯ pip install git+https://github.com/rachmadaniHaryono/we-get
    Collecting git+https://github.com/rachmadaniHaryono/we-get
    Cloning https://github.com/rachmadaniHaryono/we-get to /private/var/folders/9h/dr9mshyn6ss8cfm_qp8mgdtc0000gn/T/pip-req-build-2etnj72e
    Running command git clone -q https://github.com/rachmadaniHaryono/we-get /private/var/folders/9h/dr9mshyn6ss8cfm_qp8mgdtc0000gn/T/pip-req-build-2etnj72e
    Requirement already satisfied (use --upgrade to upgrade): we-get==1.1.0 from git+https://github.com/rachmadaniHaryono/we-get in ./Downloads/we-get
    Requirement already satisfied: colorama in ./miniconda3/envs/general/lib/python3.7/site-packages (from we-get==1.1.0) (0.3.9)
    Requirement already satisfied: docopt in ./miniconda3/envs/general/lib/python3.7/site-packages (from we-get==1.1.0) (0.6.2)
    Requirement already satisfied: prompt_toolkit>=2.0.3 in ./miniconda3/envs/general/lib/python3.7/site-packages (from we-get==1.1.0) (2.0.9)
    Requirement already satisfied: Pygments>=2.2.0 in ./miniconda3/envs/general/lib/python3.7/site-packages (from we-get==1.1.0) (2.4.2)
    Requirement already satisfied: six>=1.9.0 in ./miniconda3/envs/general/lib/python3.7/site-packages (from prompt_toolkit>=2.0.3->we-get==1.1.0) (1.12.0)
    Requirement already satisfied: wcwidth in ./miniconda3/envs/general/lib/python3.7/site-packages (from prompt_toolkit>=2.0.3->we-get==1.1.0) (0.1.7)
    Building wheels for collected packages: we-get
    Building wheel for we-get (setup.py) ... done
    Stored in directory: /private/var/folders/9h/dr9mshyn6ss8cfm_qp8mgdtc0000gn/T/pip-ephem-wheel-cache-hjsigg3m/wheels/60/3c/0f/97ac2e401ad619353118d5cc799a18140baba684cd0ca97eec
    Successfully built we-get
  2. Try download as per README.md

    
    (general) minmac@minmacMBP:~ ❯ we-get -s ubuntu -t the_pirate_bay
    Traceback (most recent call last):ay' ...
    File "/Users/minmac/miniconda3/envs/general/bin/we-get", line 11, in <module>
    load_entry_point('we-get', 'console_scripts', 'we-get')()
    File "/Users/minmac/Downloads/we-get/we_get/__init__.py", line 14, in main
    we_get.start()
    File "/Users/minmac/Downloads/we-get/we_get/core/we_get.py", line 246, in start
    sel.run()
    File "/Users/minmac/Downloads/we-get/we_get/core/we_get.py", line 160, in run
    if self.pargs['--ignore-http-error']:
    KeyError: '--ignore-http-error'
    (general) minmac@minmacMBP:~ ❯ we-get -s ubuntu -t the_pirate_bay --ignore-http-error
    Traceback (most recent call last):ay' ...
    File "/Users/minmac/miniconda3/envs/general/lib/python3.7/urllib/request.py", line 1317, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
    File "/Users/minmac/miniconda3/envs/general/lib/python3.7/http/client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
    File "/Users/minmac/miniconda3/envs/general/lib/python3.7/http/client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
    File "/Users/minmac/miniconda3/envs/general/lib/python3.7/http/client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
    File "/Users/minmac/miniconda3/envs/general/lib/python3.7/http/client.py", line 1016, in _send_output
    self.send(msg)
    File "/Users/minmac/miniconda3/envs/general/lib/python3.7/http/client.py", line 956, in send
    self.connect()
    File "/Users/minmac/miniconda3/envs/general/lib/python3.7/http/client.py", line 1392, in connect
    server_hostname=server_hostname)
    File "/Users/minmac/miniconda3/envs/general/lib/python3.7/ssl.py", line 412, in wrap_socket
    session=session
    File "/Users/minmac/miniconda3/envs/general/lib/python3.7/ssl.py", line 853, in _create
    self.do_handshake()
    File "/Users/minmac/miniconda3/envs/general/lib/python3.7/ssl.py", line 1117, in do_handshake
    self._sslobj.do_handshake()
    ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'thepiratebay.org'. (_ssl.c:1056)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/minmac/miniconda3/envs/general/bin/we-get", line 11, in load_entry_point('we-get', 'console_scripts', 'we-get')() File "/Users/minmac/Downloads/we-get/we_get/init.py", line 14, in main we_get.start() File "/Users/minmac/Downloads/we-get/we_get/core/we_get.py", line 246, in start sel.run() File "/Users/minmac/Downloads/we-get/we_get/core/we_get.py", line 162, in run items = run.main(self.pargs) File "/Users/minmac/Downloads/we-get/we_get/modules/the_pirate_bay.py", line 78, in main return run.search() File "/Users/minmac/Downloads/we-get/we_get/modules/the_pirate_bay.py", line 62, in search data = self.module.http_get_request(url) File "/Users/minmac/Downloads/we-get/we_get/core/module.py", line 24, in http_get_request return opener.open(url).read().decode() File "/Users/minmac/miniconda3/envs/general/lib/python3.7/urllib/request.py", line 525, in open response = self._open(req, data) File "/Users/minmac/miniconda3/envs/general/lib/python3.7/urllib/request.py", line 543, in _open '_open', req) File "/Users/minmac/miniconda3/envs/general/lib/python3.7/urllib/request.py", line 503, in _call_chain result = func(*args) File "/Users/minmac/miniconda3/envs/general/lib/python3.7/urllib/request.py", line 1360, in https_open context=self._context, check_hostname=self._check_hostname) File "/Users/minmac/miniconda3/envs/general/lib/python3.7/urllib/request.py", line 1319, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'thepiratebay.org'. (_ssl.c:1056)> (general) minmac@minmacMBP:~ ❯



**Expected behavior**
A list of ubuntu torrents from the pirate bay

**Desktop (please complete the following information):**
Any.
rachmadaniHaryono commented 5 years ago

can you try run?

>>> from urllib.request import Request, urlopen
... import certifi
... from we_get.core.utils import random_user_agent
... USER_AGENT = random_user_agent()
... url = 'https://thepiratebay.org/search/ubuntu/0/99/0'
... resp = urlopen(
...     Request(url, headers={'User-Agent': USER_AGENT}),
...     cafile=certifi.where())
>>> resp.read()
...