diff --git a/backend/stream.py b/backend/stream.py index 54069fc..9a8d8cd 100755 --- a/backend/stream.py +++ b/backend/stream.py @@ -370,13 +370,9 @@ class MainHandler(tornado.web.RequestHandler): image = meta.get("og:image") if isinstance(image, str): 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 - if image.endswith("hqdefault.jpg"): - 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): + if full_image != image: image_type = await handler.proxy.content_type(full_image) if isinstance(image_type, str) and image_type.startswith("image"): image = full_image