Skip to content

Commit

Permalink
[kemonoparty] add 'max-posts' option (#1674)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Jul 9, 2021
1 parent 5612ca3 commit 8b03677
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion gallery_dl/extractor/kemonoparty.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from .common import Extractor, Message
from .. import text
import itertools
import re

BASE_PATTERN = r"(?:https?://)?kemono\.party/([^/?#]+)/user/([^/?#]+)"
Expand Down Expand Up @@ -40,7 +41,12 @@ def items(self):
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
Expand Down

0 comments on commit 8b03677

Please sign in to comment.