[kemonoparty] add 'max-posts' option (#1674)
This commit is contained in:
parent
5612ca31c2
commit
8b036778e3
@ -1212,6 +1212,16 @@ Description
|
||||
Download video files.
|
||||
|
||||
|
||||
extractor.kemonoparty.max-posts
|
||||
-------------------------------
|
||||
Type
|
||||
``integer``
|
||||
Default
|
||||
``null``
|
||||
Description
|
||||
Limit the number of posts to download.
|
||||
|
||||
|
||||
extractor.kemonoparty.metadata
|
||||
------------------------------
|
||||
Type
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
from .common import Extractor, Message
|
||||
from .. import text
|
||||
import itertools
|
||||
import re
|
||||
|
||||
BASE_PATTERN = r"(?:https?://)?kemono\.party/([^/?#]+)/user/([^/?#]+)"
|
||||
@ -40,7 +41,12 @@ class KemonopartyExtractor(Extractor):
|
||||
else:
|
||||
username = None
|
||||
|
||||
for post in self.posts():
|
||||
posts = self.posts()
|
||||
max_posts = self.config("max-posts")
|
||||
if max_posts:
|
||||
posts = itertools.islice(posts, max_posts)
|
||||
|
||||
for post in posts:
|
||||
|
||||
files = []
|
||||
append = files.append
|
||||
|
Loading…
x
Reference in New Issue
Block a user