From fa3d2ca288023e358a7f4481942c5e45223bfc2f Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Tue, 6 Aug 2019 21:47:02 +0200 Subject: [PATCH] More OG tweaks --- utils/opengraph.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils/opengraph.py b/utils/opengraph.py index 53c71b2..91acccd 100644 --- a/utils/opengraph.py +++ b/utils/opengraph.py @@ -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