[kemonoparty] add 'max-posts' option (#1674)

This commit is contained in:
Mike Fährmann 2021-07-09 18:19:02 +02:00
parent 5612ca31c2
commit 8b036778e3
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 17 additions and 1 deletions

View File

@ -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

View File

@ -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