mirror of
https://github.com/kemayo/leech
synced 2025-12-06 16:33:16 +01:00
Convert Filepicker.io image URLs to Fiction.live image URLs and warn of potential failure
This commit is contained in:
parent
63ac765e41
commit
f6dc5a9ad9
1 changed files with 4 additions and 1 deletions
|
|
@ -45,8 +45,11 @@ def get_image_from_url(url: str):
|
|||
Basically the same as make_cover_from_url()
|
||||
"""
|
||||
try:
|
||||
logger.info("Downloading image from " + url)
|
||||
if url.startswith("https://www.filepicker.io/api/"):
|
||||
logger.warning("Filepicker.io image detected, converting to Fiction.live image. This might fail.")
|
||||
url = f"https://cdn3.fiction.live/fp/{url.split('/')[-1]}?&quality=95"
|
||||
img = requests.Session().get(url)
|
||||
logger.info("Downloading image from " + url)
|
||||
cover = BytesIO(img.content)
|
||||
|
||||
img_format = Image.open(cover).format
|
||||
|
|
|
|||
Loading…
Reference in a new issue