From 943af2f10b9360549aab3d98005b68712e2a3b56 Mon Sep 17 00:00:00 2001 From: Liam Steckler Date: Mon, 15 Jan 2024 08:52:24 -0800 Subject: [PATCH] Only post the article if it hasn't been already --- kuow_fetcher.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/kuow_fetcher.py b/kuow_fetcher.py index fba159c..861f2da 100644 --- a/kuow_fetcher.py +++ b/kuow_fetcher.py @@ -128,15 +128,16 @@ with Session(engine) as session: .attrs["content"] .strip() ) - mastodon_post_result = mastodon.status_post( - status=article_description - + "\n" - + kuow_base_url - + article_link - + "\n#KUOW #News{}".format(additional_tag_string), - visibility="public", - ) - article_record.post_id = mastodon_post_result["id"] + if not article_record.post_id: + mastodon_post_result = mastodon.status_post( + status=article_description + + "\n" + + kuow_base_url + + article_link + + "\n#KUOW #News{}".format(additional_tag_string), + visibility="public", + ) + article_record.post_id = mastodon_post_result["id"] except: print("Could not load a description/post this article")