[fanbox] add 'fee-max' option (#7726)

This commit is contained in:
Mike Fährmann
2025-06-24 14:47:09 +02:00
parent 308373e3cb
commit e7107f160d
4 changed files with 20 additions and 0 deletions

View File

@@ -2651,6 +2651,17 @@ Description
* ``false``: Ignore embeds.
extractor.fanbox.fee-max
------------------------
Type
``integer``
Description
Do not request API data or extract files from posts
that require a fee (``feeRequired``) greater than the specified amount.
Note: This option has no effect on individual post URLs.
extractor.fanbox.metadata
-------------------------
Type

View File

@@ -294,6 +294,7 @@
"comments": false,
"embeds" : true,
"fee-max" : null,
"metadata": false
},
"flickr":

View File

@@ -61,7 +61,14 @@ class FanboxExtractor(Extractor):
FanboxExtractor._warning = False
def items(self):
fee_max = self.config("fee-max")
for item in self.posts():
if fee_max is not None and fee_max < item["feeRequired"]:
self.log.warning("Skipping post %s (feeRequired of %s > %s)",
item["id"], item["feeRequired"], fee_max)
continue
try:
url = "https://api.fanbox.cc/post.info?postId=" + item["id"]
body = self.request_json(url, headers=self.headers)["body"]

View File

@@ -12,6 +12,7 @@ __tests__ = (
"#url" : "https://xub.fanbox.cc",
"#category": ("", "fanbox", "creator"),
"#class" : fanbox.FanboxCreatorExtractor,
"#options" : {"fee-max": 0},
"#range" : "1-15",
"#count" : ">= 15",