1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[e621] implement manual pagination mode

This commit is contained in:
ClosedPort22 2022-12-16 16:15:36 +08:00
parent 6f0735568c
commit d0ad6d0e67
No known key found for this signature in database
2 changed files with 16 additions and 1 deletions

View File

@ -1004,6 +1004,20 @@ Description
Note: This requires 1 additional HTTP request for each post.
extractor.danbooru.pagination
-----------------------------
Type
``string``
Default
``"length"``
Description
Controls when to stop paginating over API results.
* ``"length"``: Stop when the length of a batch of results is less than
the page limit.
* ``"manual"``: Only stop when a batch of results is empty.
extractor.danbooru.ugoira
-------------------------
Type

View File

@ -41,6 +41,7 @@ class DanbooruExtractor(BaseExtractor):
self.ugoira = self.config("ugoira", False)
self.external = self.config("external", False)
self.extended_metadata = self.config("metadata", False)
self.strategy = self.config("pagination", "length")
username, api_key = self._get_auth_info()
if username:
@ -126,7 +127,7 @@ class DanbooruExtractor(BaseExtractor):
posts = posts["posts"]
yield from posts
if len(posts) < self.per_page:
if self.strategy == "length" and len(posts) < self.per_page:
return
if pagenum: