mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-12-22 05:04:27 +00:00
More OG tweaks
This commit is contained in:
parent
b0cb248a23
commit
fa3d2ca288
1 changed files with 6 additions and 0 deletions
|
@ -59,6 +59,9 @@ def fetch_og_metadata(user_agent, links):
|
|||
except requests.HTTPError as http_err:
|
||||
logger.debug(f"failed to HEAD {l}, got a {http_err.response.status_code}")
|
||||
continue
|
||||
except requests.Timeout:
|
||||
logger.debug(f"HEAD {l} timed out")
|
||||
continue
|
||||
|
||||
if not h.headers.get("content-type").startswith("text/html"):
|
||||
logger.debug(f"skipping {l} for bad content type")
|
||||
|
@ -70,6 +73,9 @@ def fetch_og_metadata(user_agent, links):
|
|||
except requests.HTTPError as http_err:
|
||||
logger.debug(f"failed to GET {l}, got a {http_err.response.status_code}")
|
||||
continue
|
||||
except requests.Timeout:
|
||||
logger.debug(f"GET {l} timed out")
|
||||
continue
|
||||
|
||||
r.encoding = "UTF-8"
|
||||
html = r.text
|
||||
|
|
Loading…
Reference in a new issue