facundoolano / feedi

A personal news aggregator and Mastodon client
GNU Affero General Public License v3.0
888 stars 28 forks source link

Add fallback for when RSS entry has no title #37

Closed bfahrenfort closed 12 months ago

bfahrenfort commented 1 year ago

As per W3C's feed validator, RSS feeds that have no <title> in an <item> are still valid. With this PR, feeds like https://mastodon.social/tags/Internet.rss that validate but are not supported by feedi will be properly displayed. Also strips nasty HTML tags from the title.

Also open to adding the author to this title.

Feed for #Internet on mastodon.social: Feedi display for the RSS feed associated with the Internet tag

facundoolano commented 1 year ago

I'm ok with merging this, although I may need to revisit later on. I'm still thinking about ways in which mastodon-like entries (which are user driven) can be displayed more consistently with news/blog articles (which are title-driven). I'm thinking maybe trying to always use a username/author name in the title (falling back to feed name) and showing article title embedded in the entry body (kind of like when a link preview is embedded in a toot). But I'm not positive that I prefer a user-centric feed over a more content centric one, I need to try and see how I like it.

bfahrenfort commented 1 year ago

There's an abandoned issue at https://github.com/mastodon/mastodon/issues/24898 that discusses putting the author name in a title. I'm on board with that approach as a fallback. That's precisely what this is: a fallback, not often used and not part of the main flow of normal use.

In fact, I think a fallback title that styles something as a partial quote might look quite nice. @Username: "Something is being said..."

It is possibly redundant given the preview below the title though.

bfahrenfort commented 1 year ago

In fact, I think a fallback title that styles something as a partial quote might look quite nice.

Update on this: for Mastodon specifically, it'll need a PR upstream to be compatible since it also doesn't provide an <author> tag.

facundoolano commented 1 year ago

But the feedparser library already does the fallback to description when summary is missing, so it shouldn’t be empty in the entry dict

El El lun, 25 de sep. de 2023 a la(s) 12:58, bfahrenfort < @.***> escribió:

@.**** commented on this pull request.

In feedi/sources/rss.py https://github.com/facundoolano/feedi/pull/37#discussion_r1336094425:

@@ -87,7 +93,10 @@ def _matches(entry, filters): return True

 def parse_title(self, entry):
  • return entry['title']
  • if entry.has_key('title'): # Not required by RSS spec
  • return entry['title']
  • else: # Return first 10 words of description
  • return strip_html(' '.join(entry['description'].split()[:10]))

The feeds I was looking at don't have a

field. That's another patch for Mastodon's rss generator. Should I stall this until I tackle the lackluster generation end?

— Reply to this email directly, view it on GitHub https://github.com/facundoolano/feedi/pull/37#discussion_r1336094425, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH6ELMWDDPPSB3BL2EVYETX4GSZ5ANCNFSM6AAAAAA5FH2PBY . You are receiving this because you commented.Message ID: @.***>

bfahrenfort commented 1 year ago

But the feedparser library already does the fallback to description when summary is missing, so it shouldn’t be empty in the entry dict

perfect! I'll make the change later today.

facundoolano commented 12 months ago

closing this one since #40 made title a non required field, and will fallback to using the feed name if no title and no username.