mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
OG metadata tweaks
This commit is contained in:
parent
8355fa9597
commit
e6d124dd7d
1 changed files with 6 additions and 2 deletions
|
@ -54,7 +54,9 @@ def fetch_og_metadata(user_agent, links):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
h = requests.head(l, headers={"User-Agent": user_agent}, timeout=3)
|
h = requests.head(
|
||||||
|
l, headers={"User-Agent": user_agent}, timeout=3, allow_redirects=True
|
||||||
|
)
|
||||||
h.raise_for_status()
|
h.raise_for_status()
|
||||||
except requests.HTTPError as http_err:
|
except requests.HTTPError as http_err:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
|
@ -70,7 +72,9 @@ def fetch_og_metadata(user_agent, links):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
r = requests.get(l, headers={"User-Agent": user_agent}, timeout=5)
|
r = requests.get(
|
||||||
|
l, headers={"User-Agent": user_agent}, timeout=5, allow_redirects=True
|
||||||
|
)
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
except requests.HTTPError as http_err:
|
except requests.HTTPError as http_err:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
|
|
Loading…
Reference in a new issue