From: Aonrud <aonrud@proton.me>
---
app/templates/utils.html | 2 +-
app/utils/opengraph.py | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/app/templates/utils.html b/app/templates/utils.html
index d88a881..f25864a 100644
--- a/app/templates/utils.html
+++ b/app/templates/utils.html
@@ -413,7 +413,7 @@
<div class="activity-og-meta">
{% if og_meta.image %}
<div>
- <img src="{{ og_meta.image | media_proxy_url }}">
+ <img src="{{ og_meta.image | media_proxy_url }}" {% if og_meta.image__alt %} alt="{{ og_meta.image__alt }}"{% endif %}>
</div>
{% endif %}
<div>
diff --git a/app/utils/opengraph.py b/app/utils/opengraph.py
index 05e7752..a770889 100644
--- a/app/utils/opengraph.py
+++ b/app/utils/opengraph.py
@@ -28,6 +28,7 @@ class OpenGraphMeta(BaseModel):
url: str
title: str
image: str | None
+ image__alt: str | None
description: str | None
site_name: str
@@ -47,11 +48,12 @@ def _scrap_og_meta(url: str, html: str) -> OpenGraphMeta | None:
"url": url,
"title": soup.find("title").text.strip(),
"image": None,
+ "image__alt": None,
"description": None,
"site_name": urlparse(url).hostname,
}
for field in OpenGraphMeta.__fields__.keys():
- og_field = f"og:{field}"
+ og_field = f"og:{field.replace('__',':')}"
if ogs.get(og_field):
raw[field] = ogs.get(og_field, None)
--
2.39.2