From d9ee0a632e717f5935c4f33570a981c76402471b Mon Sep 17 00:00:00 2001 From: Liam Steckler Date: Wed, 14 Feb 2024 07:38:07 -0800 Subject: [PATCH] Update metadata exception types --- kuow_fetcher.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kuow_fetcher.py b/kuow_fetcher.py index 98590cd..880a6a4 100644 --- a/kuow_fetcher.py +++ b/kuow_fetcher.py @@ -107,14 +107,14 @@ with Session(engine) as session: article_record.dfp_targeting_id = article_soup.find( "script", {"class": "dfp_targeting", "data-key": "id"} )["data-value"] - except NameError: + except (NameError, TypeError): print("Could not find or load IDs for this post") try: tags = article_soup.find( "script", {"class": "dfp_targeting", "data-key": "tags"} )["data-value"].split("|") - except NameError: + except (NameError, TypeError): print("Could not find or load any tags for this article") tags = []