nt1m / livemarks

Extension that restores RSS Feed Livemarks in Firefox.
https://addons.mozilla.org/firefox/addon/livemarks/
MIT License
229 stars 23 forks source link

Add sorting options in feed preview #307

Open unleashit opened 3 years ago

unleashit commented 3 years ago

Feed URL https://www.smashingmagazine.com/feed

Add-on version 3.0

Describe the bug Certain feeds (like Smashing Magazine) that are published in ASC order by the publisher display in reverse and/or show old posts in Livemarks.

I haven't worked with RSS much on the development side, so forgive my lack of knowledge. Basically I'm not sure if the ordering of a published feed is important and whether it's possible for the feed reader to handle feeds published in reverse.

A problem I've seen a few times with Livemarks is when a feed is published in ascending order, it doesn't seem to care about the publish date and just displays in the order received (the older ones at the top, and cuts of the rest if more are published than Live Mark's limit... which I believe 25). With SM for example, that means I always see only the oldest 25 of the 50+ that they publish.

To Reproduce

  1. subscribe to the feed on smashingmagazine (above link).
  2. go to the home page of https://smashingmagazine.com and notice that the lastest posts aren't the ones you're seeing in your Livemarks feed.
  3. View the source of the feed URL (above) and you'll see that they're all there but in reverse. Live marks is displaying the first 25, which are all over a month old.

Expected behavior If there is a standard date field like <pubDate>, feeds could be displayed desc by date by Livemarks. Otherwise I guess not much to do as it's on the publisher.

unleashit commented 3 years ago

Update: I wrote Smashing Magazine and they have now fixed the publish order. So they aren't a good example anymore but I have seen the issue before with Tech Crunch for example. I don't currently have another example, but a nice feature to add to Live Marks would be to try to find and sort by a date column if one exists.

evilpie commented 3 years ago

This could potentially be harder than it looks. Parsing dates in RSS feeds is kind of complex, because a lot of feeds don't follow the standard. Maybe however Date in JS is lenient enough to work. In Rust this looks somewhat involved: https://github.com/feed-rs/feed-rs/blob/master/feed-rs/src/parser/util.rs

unleashit commented 3 years ago

Ok, I did a little more research and answered my own question about rss having an established format. Checked a few (fairly popular) feeds and they each had a different property for the date:

https://www.smashingmagazine.com/feed <pubDate>Tue, 29 Dec 2020 08:00:00 GMT</pubDate>

https://www.reddit.com/.rss <updated>2020-12-29T16:34:26+00:00</updated>

http://rss.slashdot.org/Slashdot/slashdotMain <dc:date>2020-12-29T23:25:00+00:00</dc:date>

As you mention, the date formats aren't standardized either, although at least these particularly examples are all ISO and can be properly parsed with the Date constructor.

So you're probably right that it's a bit of a challenge,. Maybe you have to give up on guessing the date field name and just check for date like values (and hope there's only one). new Date() was able to handle the few examples I found, but it seems likely you'd want some additional logic to try and cast them into a proper date (I can barely read Rust, but it looks like they're attempting that). Well... I'm about to get very busy so unfortunately I won't be able to put money before mouth and try to do a pull request this time around.

@nt1m just to be clear, I doubt anyone would need sorting options. This is about feeds that get published in the wrong order by the publisher. Not only do the appear upside down within Live Marks, but you only see the old ones when they publish more than 25 at a time. Maybe it's just an RSS issue in general I don't know, but I don't recall seeing the issue in other readers.