plintx / ChomikDownloader

Skrypt do pobierania plikow z http://chomikuj.pl / Script for downloading files from http://chomikuj.pl
MIT License
24 stars 8 forks source link

RecursionError on some links #3

Open shalak opened 2 months ago

shalak commented 2 months ago
  File "/root/bin/chomyk.py", line 226, in dl_step_2
    self.postData(dts)
  File "/root/bin/chomyk.py", line 140, in postData
    self.parseResponse(response.content)
  File "/root/bin/chomyk.py", line 325, in parseResponse
    self.dl_step_2(idx, agreementInfo,cost)
  File "/root/bin/chomyk.py", line 226, in dl_step_2
    self.postData(dts)
  File "/root/bin/chomyk.py", line 140, in postData
    self.parseResponse(response.content)
  File "/root/bin/chomyk.py", line 325, in parseResponse
    self.dl_step_2(idx, agreementInfo,cost)
  File "/root/bin/chomyk.py", line 226, in dl_step_2
    self.postData(dts)
  File "/root/bin/chomyk.py", line 139, in postData
    response = requests.post(url, data=body, headers=headers)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/requests/api.py", line 115, in post
    return request("post", url, data=data, json=json, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 489, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 704, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 399, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 239, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "/usr/lib/python3.11/http/client.py", line 1282, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1328, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1277, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.11/http/client.py", line 1037, in _send_output
    self.send(msg)
  File "/usr/lib/python3.11/http/client.py", line 975, in send
    self.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 205, in connect
    conn = self._new_conn()
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 73, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 964, in getaddrinfo
    addrlist.append((_intenum_converter(af, AddressFamily),
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/socket.py", line 105, in _intenum_converter
    return enum_klass(value)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/enum.py", line 717, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/enum.py", line 1106, in __new__
    return cls._value2member_map_[value]
           ^^^^^^^^^^^^^^^^^^^^^^
RecursionError: maximum recursion depth exceeded while calling a Python object

This happens when I provide URL to the folder, as well as an URL for a file in a folder.

Folder in question is 67GB, 843 files in it.

Any idea how to solve, or work around this? This is first time I'm getting this error.

shalak commented 2 months ago

I believe this happens because there's an additional prompt when downloading from this folder:

Właściciel chomika pozwolił pobierać pliki z tego folderu na koszt jego transferu (nawet bez logowania do portalu).
image

I guess the script doesn't handle this case?

shalak commented 2 months ago

I found a workaround: instead of downloading directly, we must add it to our own "Chomik" (i.e. use the "Zachomikuj" feature), then use the link from our folder.