From 42407afb6de722e72a67dc746c1d50963dd3c3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 4 Feb 2026 21:51:55 +0100 Subject: [PATCH] [xenforo] implement '"order-posts": "reaction"' (#8997) --- docs/configuration.rst | 9 +++++++-- gallery_dl/extractor/xenforo.py | 15 ++++++++++----- test/results/simpcity.py | 13 +++++++++++++ 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 26891d49..a6982394 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -7307,15 +7307,20 @@ extractor.[xenforo].order-posts Type ``string`` Default - ``"desc"`` + ``thread`` + ``"desc"`` + otherwise + ``"asc"`` Description Controls the order in which - posts of a ``thread`` are processed. + posts of a ``thread`` or `media` files are processed. ``"asc"`` Ascending order (oldest first) ``"desc"`` | ``"reverse"`` Descending order (newest first) + ``"reaction"`` | ``"score"`` + Reaction Score order (``threads`` only) extractor.ytdl.cmdline-args diff --git a/gallery_dl/extractor/xenforo.py b/gallery_dl/extractor/xenforo.py index 203c3f0d..a09cf43c 100644 --- a/gallery_dl/extractor/xenforo.py +++ b/gallery_dl/extractor/xenforo.py @@ -198,14 +198,14 @@ class XenforoExtractor(BaseExtractor): if cookie.domain.endswith(self.cookies_domain) } - def _pagination(self, base, pnum=None, callback=None): + def _pagination(self, base, pnum=None, callback=None, params=""): base = self.root + base if pnum is None: - url = base + "/" + url = f"{base}/{params}" pnum = 1 else: - url = f"{base}/page-{pnum}" + url = f"{base}/page-{pnum}{params}" pnum = None page = self.request_page(url).text @@ -217,7 +217,7 @@ class XenforoExtractor(BaseExtractor): if pnum is None or "pageNav-jump--next" not in page: return pnum += 1 - page = self.request_page(f"{base}/page-{pnum}").text + page = self.request_page(f"{base}/page-{pnum}{params}").text def _pagination_reverse(self, base, pnum=None, callback=None): base = self.root + base @@ -485,7 +485,12 @@ class XenforoThreadExtractor(XenforoExtractor): if (order := self.config("order-posts")) and \ order[0] not in ("d", "r"): - pages = self._pagination(path, pnum) + params = "?order=reaction_score" if order[0] == "s" else "" + pages = self._pagination(path, pnum, params=params) + reverse = False + elif order == "reaction": + pages = self._pagination( + path, pnum, params="?order=reaction_score") reverse = False else: pages = self._pagination_reverse(path, pnum) diff --git a/test/results/simpcity.py b/test/results/simpcity.py index dc0ac266..8337ddbe 100644 --- a/test/results/simpcity.py +++ b/test/results/simpcity.py @@ -302,6 +302,19 @@ __tests__ = ( "#class" : xenforo.XenforoThreadExtractor, }, +{ + "#url" : "https://simpcity.cr/threads/ririkana-rr_loveit.10731/", + "#comment" : "post order by reaction score (#8997)", + "#category": ("xenforo", "simpcity", "thread"), + "#class" : xenforo.XenforoThreadExtractor, + "#auth" : True, + "#options" : { + "post-range" : 1, + "order-posts": "reaction", + }, + "#results" : "https://bunkr.cr/v/BKLYkkr9KK6dg", +}, + { "#url" : "https://simpcity.cr/forums/asians.48/", "#category": ("xenforo", "simpcity", "forum"),