Extract SVG & object data attrs for og:image meta tags

This commit is contained in:
Russell Ballestrini 2025-12-18 15:26:27 -05:00
parent c647048f9d
commit dcdd20b43d

View file

@ -113,7 +113,7 @@ import re
def extract_first_image(content): def extract_first_image(content):
"""Extract first image URL from HTML content.""" """Extract first image URL from HTML content."""
match = re.search(r'(?:src|href)=["\']([^"\']+\.(?:jpg|jpeg|png|gif|webp))["\']', content, re.IGNORECASE) match = re.search(r'(?:src|href|data)=["\']([^"\']+\.(?:jpg|jpeg|png|gif|webp|svg))["\']', content, re.IGNORECASE)
return match.group(1) if match else None return match.group(1) if match else None
JINJA_FILTERS = {'extract_first_image': extract_first_image} JINJA_FILTERS = {'extract_first_image': extract_first_image}