[vipergirls] implement 'order-posts' option (#8248)

This commit is contained in:
Mike Fährmann
2025-09-21 19:19:59 +02:00
parent 8d672fb1ea
commit 5066de020a
4 changed files with 31 additions and 5 deletions

View File

@@ -51,8 +51,16 @@ class VipergirlsExtractor(Extractor):
like = False
posts = root.iter("post")
if self.page:
util.advance(posts, (text.parse_int(self.page[5:]) - 1) * 15)
if (order := self.config("order-posts")) and \
order[0] not in ("d", "r"):
if self.page:
util.advance(posts, (text.parse_int(self.page[5:]) - 1) * 15)
else:
posts = list(posts)
if self.page:
offset = text.parse_int(self.page[5:]) * 15
posts = posts[:offset]
posts.reverse()
for post in posts:
images = list(post)