Created
November 20, 2018 22:54
-
-
Save shinypb/80d795161ff502ab5010fb31d3ba3dd7 to your computer and use it in GitHub Desktop.
A simple feedfilterer rule I originally wrote to de-dupe entries in the Pinboard "popular" feed (https://feeds.pinboard.in/rss/popular/)
This file contains 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
// List of URLs we've seen this session | |
// TODO: persist this to disk somewhere so we do a better job of de-duping | |
const seenUrls = []; | |
/** | |
* Removes duplicate links to the same item. | |
* @param {FeedItem} item | |
* @return {Boolean} true if we should mark this item as read, false if not | |
*/ | |
module.exports = function DedupeLinks(item) { | |
if (seenUrls.indexOf(item.itemUrl) >= 0) { | |
return true; | |
} | |
seenUrls.push(item.itemUrl); | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment