1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 10:42:34 +01:00
The previous code would raise an exception when there are no or
more than 1 plans with a fee higher than 'feeRequired'.
This commit is contained in:
Mike Fährmann 2024-06-21 18:56:43 +02:00
parent f58b0e6fc7
commit ad25be3420
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -117,8 +117,15 @@ class FanboxExtractor(Extractor):
try:
post["plan"] = plans[fee]
except KeyError:
post["plan"] = plans[fee] = min(
p for p in plans.values() if p["fee"] >= fee)
fees = [f for f in plans if f >= fee]
if fees:
plan = plans[min(fees)]
else:
plan = plans[0].copy()
plan["fee"] = fee
post["plan"] = plans[fee] = plan
print(post["plan"])
exit()
return content_body, post