mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
More OG meta tweaks
This commit is contained in:
parent
e6d124dd7d
commit
1061b13029
1 changed files with 7 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
import logging
|
||||
import mimetypes
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
from typing import Set
|
||||
|
@ -41,6 +42,12 @@ def links_from_note(note: Dict[str, Any]) -> Set[str]:
|
|||
def fetch_og_metadata(user_agent, links):
|
||||
res = []
|
||||
for l in links:
|
||||
# Try to skip media early
|
||||
mimetype, _ = mimetypes.guess_type(l)
|
||||
if mimetype and mimetype.split("/")[0] in ["image", "video", "audio"]:
|
||||
logger.info(f"skipping media link {l}")
|
||||
continue
|
||||
|
||||
check_url(l)
|
||||
|
||||
# Remove any AP objects
|
||||
|
|
Loading…
Reference in a new issue