1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 18:53:21 +01:00

[fanbox] fix pagination (#5949, #5951, #5956)

This commit is contained in:
Mike Fährmann 2024-08-07 09:58:29 +02:00
parent 605f6fba2c
commit b4733b7ea8
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 17 additions and 5 deletions

View File

@ -309,8 +309,20 @@ class FanboxCreatorExtractor(FanboxExtractor):
self.creator_id = match.group(1) or match.group(2) self.creator_id = match.group(1) or match.group(2)
def posts(self): def posts(self):
url = "https://api.fanbox.cc/post.listCreator?creatorId={}&limit=10" url = "https://api.fanbox.cc/post.paginateCreator?creatorId="
return self._pagination(url.format(self.creator_id)) return self._pagination_creator(url + self.creator_id)
def _pagination_creator(self, url):
urls = self.request(url, headers=self.headers).json()["body"]
for url in urls:
url = text.ensure_http_scheme(url)
body = self.request(url, headers=self.headers).json()["body"]
for item in body:
try:
yield self._get_post_data(item["id"])
except Exception as exc:
self.log.warning("Skipping post %s (%s: %s)",
item["id"], exc.__class__.__name__, exc)
class FanboxPostExtractor(FanboxExtractor): class FanboxPostExtractor(FanboxExtractor):

View File

@ -133,9 +133,9 @@ __tests__ = (
"feeRequired": 300, "feeRequired": 300,
"plan" : { "plan" : {
"creatorId": "saki9184", "creatorId": "saki9184",
"fee" : 350, "fee" : 300,
"id" : "414274", "id" : "430208",
"title" : "涼宮ハルヒの憂鬱", "title" : "ユーフォ、氷菓同人イラストR18",
}, },
}, },