Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
biggestsonicfan opened this issue Jun 18, 2024 · 1 comment
Closed
Labels

Comments

@biggestsonicfan
Copy link

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.

@mikf mikf added the site:bug label Jun 18, 2024
mikf added a commit that referenced this issue Jun 20, 2024
return the plan of the next higher tier instead
@mikf mikf closed this as completed Jun 20, 2024
@mikf mikf reopened this Jun 21, 2024
mikf added a commit that referenced this issue Jun 21, 2024
The previous code would raise an exception when there are no or
more than 1 plans with a fee higher than 'feeRequired'.
@mikf mikf closed this as completed Jun 21, 2024
mikf added a commit that referenced this issue Jun 21, 2024
@biggestsonicfan
Copy link
Author

Works a treat!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants