Compare commits

...

3 commits

Author SHA1 Message Date
257d61aefc Merge pull request 'Update metadata exception types to catch TypeErrors' (#19) from update-metadata-exceptions into main
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
Reviewed-on: #19
2024-02-14 07:52:59 -08:00
9a52805213 Merge remote-tracking branch 'origin/main' into update-metadata-exceptions
All checks were successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pull_request_closed/lint Pipeline was successful
2024-02-14 07:38:18 -08:00
d9ee0a632e Update metadata exception types 2024-02-14 07:38:07 -08:00

View file

@ -127,14 +127,14 @@ with Session(engine) as session:
article_record.dfp_targeting_id = article_soup.find( article_record.dfp_targeting_id = article_soup.find(
"script", {"class": "dfp_targeting", "data-key": "id"} "script", {"class": "dfp_targeting", "data-key": "id"}
)["data-value"] )["data-value"]
except NameError: except (NameError, TypeError):
print("Could not find or load IDs for this post") print("Could not find or load IDs for this post")
try: try:
tags = article_soup.find( tags = article_soup.find(
"script", {"class": "dfp_targeting", "data-key": "tags"} "script", {"class": "dfp_targeting", "data-key": "tags"}
)["data-value"].split("|") )["data-value"].split("|")
except NameError: except (NameError, TypeError):
print("Could not find or load any tags for this article") print("Could not find or load any tags for this article")
tags = [] tags = []