From 877ea44059e60c7a2e24c2310fbf78cd74851623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 9 Oct 2025 17:27:47 +0200 Subject: [PATCH] [fansly] download user posts from all account walls (#4401) when no specific wallId is specified --- gallery_dl/extractor/fansly.py | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/gallery_dl/extractor/fansly.py b/gallery_dl/extractor/fansly.py index 5aad7d16..7138599e 100644 --- a/gallery_dl/extractor/fansly.py +++ b/gallery_dl/extractor/fansly.py @@ -9,7 +9,7 @@ """Extractors for https://fansly.com/""" from .common import Extractor, Message -from .. import text, util +from .. import text, util, exception import time BASE_PATTERN = r"(?:https?://)?(?:www\.)?fansly\.com" @@ -43,6 +43,23 @@ class FanslyExtractor(Extractor): url = file["url"] yield Message.Url, url, text.nameext_from_url(url, post) + def posts(self): + creator, wall_id = self.groups + account = self.api.account(creator) + walls = account["walls"] + + if wall_id: + for wall in walls: + if wall["id"] == wall_id: + break + else: + raise exception.NotFoundError("wall") + walls = (wall,) + + for wall in walls: + self.kwdict["wall"] = wall + yield from self.posts_wall(account, wall) + def _extract_files(self, post): files = [] @@ -190,11 +207,8 @@ class FanslyCreatorPostsExtractor(FanslyExtractor): pattern = rf"{BASE_PATTERN}/([^/?#]+)/posts(?:/wall/(\d+))?" example = "https://fansly.com/CREATOR/posts" - def posts(self): - creator, wall_id = self.groups - account = self.api.account(creator) - return self.api.timeline_new( - account["id"], wall_id or account["walls"][0]["id"]) + def posts_wall(self, account, wall): + return self.api.timeline_new(account["id"], wall["id"]) class FanslyCreatorMediaExtractor(FanslyExtractor): @@ -202,11 +216,8 @@ class FanslyCreatorMediaExtractor(FanslyExtractor): pattern = rf"{BASE_PATTERN}/([^/?#]+)/media(?:/wall/(\d+))?" example = "https://fansly.com/CREATOR/media" - def posts(self): - creator, wall_id = self.groups - account = self.api.account(creator) - return self.api.mediaoffers_location( - account["id"], wall_id or account["walls"][0]["id"]) + def posts_wall(self, account, wall): + return self.api.mediaoffers_location(account["id"], wall["id"]) class FanslyAPI():