L4cache / kemono-dl

(personal fork of) A simple kemono.party downloader using python.
93 stars 14 forks source link

Downloader breaks when trying to download from a 404'd page #7

Closed thumbulonprime closed 1 year ago

thumbulonprime commented 1 year ago

Version

Version: 2022.04.28 (downloaded from 'main' branch at 2022.10.09

Your Command


python kemono-dl.py --cookies "kemono.party_cookies.txt" --kemono-fav-posts --content --dirname-pattern "Downloads2" --filename-pattern "[{published}] - {username} ({service}_{user_id}) - {title} ({id}) {index}_{filename}.{ext}" --other-filename-pattern "[{published}] - {username} ({service}_{user_id}) - {title} ({id}).{ext}" --verbose

Description of bug

The downloader crashes when it reaches a post in the favourited posts list that gives a 404 error.

How To Reproduce

download the contents from a post where the artist page gives a 404 error.

Error messages and tracebacks


2022-10-09 21:11:59,074:INFO:Downloading posts from kemono.party.party | fanbox | 恋童机器 | 80271311
2022-10-09 21:11:59,074:DEBUG:Requesting post json from: https://kemono.party/api/fanbox/user/80271311/post/4027596
2022-10-09 21:11:59,123:ERROR:Unable to get favorite posts from kemono.party
Traceback (most recent call last):
  File "C:\Users\****\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\requests\models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\****\src\main.py", line 665, in start_download
    self.get_favorites('kemono.party', 'post')
  File "D:\****\src\main.py", line 122, in get_favorites
    self.get_post(f"https://{domain}/{favorite['service']}/user/{favorite['user']}/post/{favorite['id']}")
  File "D:\****\src\main.py", line 152, in get_post
    json = self.session.get(url=api, cookies=self.cookies, headers=self.headers, timeout=self.timeout).json()
  File "C:\Users\****\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\requests\models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Additional comments

L4cache commented 1 year ago

try download from user link with --force-unlisted