From 7d85cce55367f46d2cca06b9ac2301929f0af05f Mon Sep 17 00:00:00 2001 From: Florent Date: Sun, 24 Dec 2023 12:38:54 +0100 Subject: [PATCH] Prevent from getting the same article two days in a row --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 67fb851..8e2610c 100644 --- a/main.go +++ b/main.go @@ -101,8 +101,10 @@ func searchArticle(channelID string) string { if href_, exists := a.Attr("href"); exists { long_href := e.Request.AbsoluteURL(href_) href = strings.Split(long_href, "?source")[0] - setupData.PreviousArticle = href - serializeData(CONFIG_SOURCE, setupData) + if setupData.PreviousArticle != "" && setupData.PreviousArticle != href { + setupData.PreviousArticle = href + serializeData(CONFIG_SOURCE, setupData) + } } } })