From be23df35916e74e389d61f24fe3ed87a86b4a4b6 Mon Sep 17 00:00:00 2001 From: MMaker Date: Tue, 25 Feb 2025 18:04:59 -0500 Subject: [PATCH] Meta tag cleanup Maybe fixes site title not displaying? --- app.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app.py b/app.py index 94e3045..6be13c0 100644 --- a/app.py +++ b/app.py @@ -205,6 +205,9 @@ def get_data(video_id, real_url): def get_oembed_url(params): """Get the oEmbed (/owoembed) URL based on the given params (server response)""" + if not params: + return None + author_id = params.get('owner', {}).get('id') author_name = params.get('owner', {}).get('nickname') video_id = params.get('video', {}).get('id') @@ -272,6 +275,8 @@ def proxy(video_id): og_video_width = None og_video_height = None for tag in og_tags: + if 'data-server' in tag.attrs: + del tag.attrs['data-server'] # Fix thumbnail if tag.get("property") == "og:image" and thumbnail_url: tag["content"] = thumbnail_url @@ -287,6 +292,7 @@ def proxy(video_id): og_tags_str = "\n".join(str(tag) for tag in og_tags) og_tags_str += '\n' og_tags_str += '\n' + og_tags_str += '\n' og_tags_str += f'\n' if og_video_width: og_tags_str += f'\n'