mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
[pixiv] implement 'max-posts' option (#1558)
* implement max-rank for pixiv * rename to max-posts and make more generic
This commit is contained in:
parent
8a909e478d
commit
e6811c7450
@ -1419,6 +1419,17 @@ Description
|
||||
.. __: https://github.com/mikf/gallery-dl/blob/v1.12.3/docs/gallery-dl-example.conf#L9-L14
|
||||
|
||||
|
||||
extractor.pixiv.max-posts
|
||||
-------------------------
|
||||
Type
|
||||
``integer``
|
||||
Default
|
||||
``0``
|
||||
Description
|
||||
When downloading galleries, this sets the maximum number of posts to get.
|
||||
A value of ``0`` means no limit.
|
||||
|
||||
|
||||
extractor.plurk.comments
|
||||
------------------------
|
||||
Type
|
||||
|
@ -29,6 +29,7 @@ class PixivExtractor(Extractor):
|
||||
Extractor.__init__(self, match)
|
||||
self.api = PixivAppAPI(self)
|
||||
self.load_ugoira = self.config("ugoira", True)
|
||||
self.max_posts = self.config("max-posts", 0)
|
||||
|
||||
def items(self):
|
||||
tags = self.config("tags", "japanese")
|
||||
@ -46,7 +47,10 @@ class PixivExtractor(Extractor):
|
||||
ratings = {0: "General", 1: "R-18", 2: "R-18G"}
|
||||
metadata = self.metadata()
|
||||
|
||||
for work in self.works():
|
||||
works = self.works()
|
||||
if self.max_posts:
|
||||
works = itertools.islice(works, self.max_posts)
|
||||
for work in works:
|
||||
if not work["user"]["id"]:
|
||||
continue
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user