DragoonAethis / itch-dl

Download all games from a public Itch.io Game Jam
MIT License
61 stars 10 forks source link

Crash - TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' #15

Closed TheFrenchGhosty closed 5 months ago

TheFrenchGhosty commented 5 months ago

Consistently happen when I download:

Password protected: https://beowulf.itch.io/rpg-boss-monsters-minions-huge-pack https://world-land-trust.itch.io/thank-you-from-the-world-land-trust https://jayskibean.itch.io/microhorrorarcade-trilogy-i

Access restricted https://witpop.itch.io/sprite-pack-fantasy-male-mage

(or https://itch.io/my-purchases ).

The issues seems to be that the script can't handle any page that isn't publicly available.

A solution might just be to add proper handling... or just to ignore those (and maybe output the page URL to a file so that they can be downloaded manually)

This effectively crashes the itch-dl and requires re-starting it to download other files (I ended up just running it on loop)

Traceback (most recent call last):
  File "/home/<username>/.local/bin/itch-dl", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/home/<username>/.local/share/pipx/venvs/itch-dl/lib/python3.11/site-packages/itch_dl/cli.py", line 87, in run
    return drive_downloads(jobs, download_to, args.mirror_web, settings, keys, parallel=args.parallel)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<username>/.local/share/pipx/venvs/itch-dl/lib/python3.11/site-packages/itch_dl/downloader.py", line 355, in drive_downloads
    results = thread_map(downloader.download, jobs, max_workers=parallel, **tqdm_args)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<username>/.local/share/pipx/venvs/itch-dl/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 69, in thread_map
    return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<username>/.local/share/pipx/venvs/itch-dl/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 51, in _executor_map
    return list(tqdm_class(ex.map(fn, *iterables, chunksize=chunksize), **kwargs))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<username>/.local/share/pipx/venvs/itch-dl/lib/python3.11/site-packages/tqdm/std.py", line 1181, in __iter__
    for obj in iterable:
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 619, in result_iterator
    yield _result_or_cancel(fs.pop())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 317, in _result_or_cancel
    return fut.result(timeout)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<username>/.local/share/pipx/venvs/itch-dl/lib/python3.11/site-packages/itch_dl/downloader.py", line 240, in download
    game_id = self.get_game_id(url, site)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<username>/.local/share/pipx/venvs/itch-dl/lib/python3.11/site-packages/itch_dl/downloader.py", line 117, in get_game_id
    game_id = int(data_request.json().get("id"))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
TheFrenchGhosty commented 5 months ago

Looks like it's the same issue as #14

DragoonAethis commented 5 months ago

Yup, same as #14, crash fixed in 0.4.1, see #16 for a tracker on downloading restricted items. Thanks for your report!