1
0
Fork 0
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:
Emmanuel Jemeni 2023-03-25 17:08:40 +01:00 committed by David Lynch
parent 63ac765e41
commit f6dc5a9ad9

View file

@ -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