mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
10.68k stars 881 forks source link

[Fanbox] KeyError raised on posts where the tier no longer exists #5759

Closed biggestsonicfan closed 1 week ago

biggestsonicfan commented 1 week ago

Example link - User has 300 JPY locked post but only a 350 JPY plan offered. The 350 JPY plan allows 300 JPY (and 100 JPY) posts to be viewed.

Verbose output:

XXXXX@DESKTOP-5ETERDG:~> gallery-dl --verbose https://saki9184.fanbox.cc/posts/7754760
gallery-dl: Version 1.27.1-dev
gallery-dl: Python 3.11.9 - Linux-5.15.153.1-microsoft-standard-WSL2-x86_64-with-glibc2.39
gallery-dl: requests 2.31.0 - urllib3 2.2.1
gallery-dl: Configuration Files ['${HOME}/.gallery-dl.conf']
gallery-dl: Starting DownloadJob for 'https://saki9184.fanbox.cc/posts/7754760'
fanbox: Using FanboxPostExtractor for 'https://saki9184.fanbox.cc/posts/7754760'
cookies: Extracting cookies from /run/media/XXXXX/c/Users/bigge/AppData/Roaming/Mozilla/Firefox/Profiles/seuqhdmj.default-release/cookies.sqlite
cookies: Extracted 10 cookies from Firefox
urllib3.connectionpool: Starting new HTTPS connection (1): api.fanbox.cc:443
urllib3.connectionpool: https://api.fanbox.cc:443 "GET /post.info?postId=7754760 HTTP/1.1" 200 679
fanbox: Sleeping 3.50 seconds (request)
urllib3.connectionpool: https://api.fanbox.cc:443 "GET /creator.get?creatorId=saki9184 HTTP/1.1" 200 805
fanbox: Sleeping 3.50 seconds (request)
urllib3.connectionpool: https://api.fanbox.cc:443 "GET /plan.listCreator?creatorId=saki9184 HTTP/1.1" 200 552
fanbox: An unexpected error occurred: KeyError - 300. Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues .
fanbox:
Traceback (most recent call last):
  File "/home/XXXXX/py-scripts/venv/lib64/python3.11/site-packages/gallery_dl/job.py", line 150, in run
    for msg in extractor:
  File "/home/XXXXX/py-scripts/venv/lib64/python3.11/site-packages/gallery_dl/extractor/fanbox.py", line 52, in items
    for content_body, post in self.posts():
                              ^^^^^^^^^^^^
  File "/home/XXXXX/py-scripts/venv/lib64/python3.11/site-packages/gallery_dl/extractor/fanbox.py", line 317, in posts
    return (self._get_post_data(self.post_id),)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/XXXXX/py-scripts/venv/lib64/python3.11/site-packages/gallery_dl/extractor/fanbox.py", line 116, in _get_post_data
    post["plan"] = plans[post["feeRequired"]]
                   ~~~~~^^^^^^^^^^^^^^^^^^^^^
KeyError: 300

The feeRequired seems absolute when it should be if it's less than the current plan.

biggestsonicfan commented 1 week ago

Works a treat!