From 03bb1280050e6fcb09405c8848cb58ec7807f8d9 Mon Sep 17 00:00:00 2001 From: Andrew Kvalheim Date: Thu, 14 Jul 2022 09:41:33 -0700 Subject: [PATCH] Key entries by link if missing ID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves the problem of incorrectly duplicated entries in feeds that update content but don’t explicitly provide entry IDs. Example feed: - https://www.to-rss.xyz/wikipedia/current_events/ Example entry: Current events: 2022-07-13 https://en.wikipedia.org/wiki/Portal:Current_events/2022_July_13 [VARIABLE CONTENT] Wed, 13 Jul 2022 00:00:00 -0000 This behavior is suggested by the common practice of using an entry’s link as its ID value, and is consistent with typical feed aggregators such as Feedbin and Inoreader. --- rss/bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rss/bot.py b/rss/bot.py index 0352f4c..42ca897 100644 --- a/rss/bot.py +++ b/rss/bot.py @@ -279,12 +279,12 @@ class RSSBot(Plugin): feed_id=feed_id, id=( getattr(entry, "id", None) + or getattr(entry, "link", None) or hashlib.sha1( " ".join( [ getattr(entry, "title", ""), getattr(entry, "description", ""), - getattr(entry, "link", ""), ] ).encode("utf-8") ).hexdigest()