From 912fe87767e7e5434dbb25b527b3f35e9e4f486b Mon Sep 17 00:00:00 2001 From: nex Date: Sat, 10 Feb 2024 01:23:14 +0000 Subject: [PATCH] Fix tags not starting with og: --- server.py | 136 +++++++++++++++++++++++++++--------------------------- 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/server.py b/server.py index 7cefa9b..c1b8a82 100644 --- a/server.py +++ b/server.py @@ -34,75 +34,75 @@ INVALID_TOKEN = JSONResponse( 401 ) VALID_OG_TAGS = [ - "title", - "type", - "image", - "url", - "audio", - "description", - "determiner", - "locale", - "locale:alternative", - "site_name", - "image:url", - "image:secure_url", - "image:type", - "image:width", - "image:height", - "image:alt", - "video", - "video:url", - "video:secure_url", - "video:type", - "video:width", - "video:height", - "video:alt", - "video:actor", - "video:actor:role", - "video:director", - "video:writer", - "video:duration", - "video:release_date", - "video:tag", - "video:series" - "audio:url", - "audio:secure_url", - "audio:type", - "music:duration", - "music:album", - "music:album:disc", - "music:album:track", - "music:musician", - "music:song", - "music:song:disc", - "music:song:track", - "music:release_date", - "music:creator", - "article:published_time", - "article:modified_time", - "article:expiration_time", - "article:author", - "article:section", - "article:tag", - "book:author", - "book:tag", - "book:isbn", - "book:release_date", - "profile:first_name", - "profile:last_name", - "profile:username", - "profile:gender" + "og:title", + "og:type", + "og:image", + "og:url", + "og:audio", + "og:description", + "og:determiner", + "og:locale", + "og:locale:alternative", + "og:site_name", + "og:image:url", + "og:image:secure_url", + "og:image:type", + "og:image:width", + "og:image:height", + "og:image:alt", + "og:video", + "og:video:url", + "og:video:secure_url", + "og:video:type", + "og:video:width", + "og:video:height", + "og:video:alt", + "og:video:actor", + "og:video:actor:role", + "og:video:director", + "og:video:writer", + "og:video:duration", + "og:video:release_date", + "og:video:tag", + "og:video:series" + "og:audio:url", + "og:audio:secure_url", + "og:audio:type", + "og:music:duration", + "og:music:album", + "og:music:album:disc", + "og:music:album:track", + "og:music:musician", + "og:music:song", + "og:music:song:disc", + "og:music:song:track", + "og:music:release_date", + "og:music:creator", + "og:article:published_time", + "og:article:modified_time", + "og:article:expiration_time", + "og:article:author", + "og:article:section", + "og:article:tag", + "og:book:author", + "og:book:tag", + "og:book:isbn", + "og:book:release_date", + "og:profile:first_name", + "og:profile:last_name", + "og:profile:username", + "og:profile:gender" ] URL_OG_TAGS = [ - "video", - "video:url", - "video:secure_url", - "image", - "image:url", - "image:secure_url", - "audio", - "audio:url", - "audio:secure_url" + "og:video", + "og:video:url", + "og:video:secure_url", + "og:image", + "og:image:url", + "og:image:secure_url", + "og:audio", + "og:audio:url", + "og:audio:secure_url" ] @@ -176,7 +176,7 @@ def preview_url( if tag.get("property", "").startswith("og:"): tag_name = tag.get("property")[3:] if tag_name in VALID_OG_TAGS: - og_tags[tag_name] = tag.get("content") + og_tags["og:" + tag_name] = tag.get("content", tag.get("value")) for tag_name in URL_OG_TAGS: if tag_name in og_tags: