[fanbox] add 'fee-max' option (#7726)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -294,6 +294,7 @@
|
||||
|
||||
"comments": false,
|
||||
"embeds" : true,
|
||||
"fee-max" : null,
|
||||
"metadata": false
|
||||
},
|
||||
"flickr":
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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",
|
||||
|
||||
|
||||
Reference in New Issue
Block a user