image size regex
This commit is contained in:
parent
51530c2a6b
commit
e942d73474
@ -370,13 +370,9 @@ class MainHandler(tornado.web.RequestHandler):
|
|||||||
image = meta.get("og:image")
|
image = meta.get("og:image")
|
||||||
if isinstance(image, str):
|
if isinstance(image, str):
|
||||||
if handler.provider == "youtube":
|
if handler.provider == "youtube":
|
||||||
full_image = None
|
full_image = re.sub(r'\/[a-zA-Z0-9]+\.([a-zA-Z0-9]+)$', r'/maxresdefault.\1', image)
|
||||||
image_type = None
|
image_type = None
|
||||||
if image.endswith("hqdefault.jpg"):
|
if full_image != image:
|
||||||
full_image = image.removesuffix("hqdefault.jpg") + "maxresdefault.jpg"
|
|
||||||
elif image.endswith("hqdefault.webp"):
|
|
||||||
full_image = image.removesuffix("hqdefault.webp") + "maxresdefault.webp"
|
|
||||||
if isinstance(full_image, str):
|
|
||||||
image_type = await handler.proxy.content_type(full_image)
|
image_type = await handler.proxy.content_type(full_image)
|
||||||
if isinstance(image_type, str) and image_type.startswith("image"):
|
if isinstance(image_type, str) and image_type.startswith("image"):
|
||||||
image = full_image
|
image = full_image
|
||||||
|
Loading…
Reference in New Issue
Block a user