diff --git a/gallery_dl/extractor/kemonoparty.py b/gallery_dl/extractor/kemonoparty.py index 631d8c3390..d770c24efc 100644 --- a/gallery_dl/extractor/kemonoparty.py +++ b/gallery_dl/extractor/kemonoparty.py @@ -568,14 +568,19 @@ def _call(self, endpoint, params=None): response = self.extractor.request(url, params=params) return response.json() - def _pagination(self, endpoint, params, batch=50, key=None): + def _pagination(self, endpoint, params, batch=50, key=False): offset = text.parse_int(params.get("o")) params["o"] = offset - offset % batch while True: data = self._call(endpoint, params) - yield from data.get(key, data) - if len(data.get(key, data)) < batch: - return + if key: + yield from data.get(key) + if len(data.get(key)) < batch: + return + else: + yield from data + if len(data) < batch: + return params["o"] += batch