From 089af0de590eb8a679c9d9ea7714ebfd7baec274 Mon Sep 17 00:00:00 2001 From: Liam Steckler Date: Thu, 13 Apr 2023 11:58:41 -0700 Subject: [PATCH] Reverse articles before processing --- kuow_fetcher.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kuow_fetcher.py b/kuow_fetcher.py index 05a558b..940a982 100644 --- a/kuow_fetcher.py +++ b/kuow_fetcher.py @@ -8,7 +8,11 @@ mastodon = Mastodon(access_token = 'kuow_bot_mastodon.secret') r = requests.get(url) soup = BeautifulSoup(r.content, 'html.parser') -for article in soup.find_all("span", class_ = "txt"): +articles = soup.find_all("span", class_ = "txt") +# Reverse articles, so that if multiple new ones have been found, they'll be posted in order of when published +articles.reverse() + +for article in articles: article_link = article.find("a").attrs["href"] is_new_article = True