Extract SVG & object data attrs for og:image meta tags
This commit is contained in:
parent
c647048f9d
commit
dcdd20b43d
1 changed files with 1 additions and 1 deletions
|
|
@ -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}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue