Fix duplicate RSS items when pubDate is missing#743
Closed
kion wants to merge 2 commits intoyang991178:masterfrom
Closed
Fix duplicate RSS items when pubDate is missing#743kion wants to merge 2 commits intoyang991178:masterfrom
kion wants to merge 2 commits intoyang991178:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
RSS feed items without a
pubDatefield are duplicated on every feed refresh.Example feed: https://rsshub.app/anthropic/engineering
The article "Writing effective tools for agents — with agents" lacks a
pubDate, causing it to appear at the top of the feed list after each refresh.Root Cause
When an RSS item has no
pubDateorisoDate, theRSSItemconstructor falls back to the current fetch time:The original deduplication logic used
(source, title, date)as a composite key. Since the date changes on each fetch, the duplicate check fails and the same item gets inserted repeatedly.Solution
Use the item's link as the primary deduplication key instead of the date-based composite key:
(source, link)(source, title, date)Also fixed sorting for items without
pubDate. Previously, these items appeared at the top of the feed (sorted as "newest" since they used the current fetch time). Now they appear at the bottom while preserving their feed order.Testing
Tested with multiple RSS feeds, including the problematic aforementioned one, as well as multiple others that worked fine initially (to confirm nothing got broken). No duplicates appear after multiple refreshes. Items without publication date appear on the bottom of the list.