Ashinch / ReadYou

An Android RSS reader presented in Material You style.
GNU General Public License v3.0
4.84k stars 188 forks source link

Use the article thumbnail from the `<enclosure>` tag in the item #669

Closed alessandrojean closed 6 months ago

alessandrojean commented 6 months ago

1. Environment

2. Describe the feature request

Currently, the RSS parser while parsing RSS2 feeds gets the item image/thumbnail by finding the first <img> element in the <content> (reference in RssHelper.kt), but some sites may already provide the thumbnail in an <enclosure> element inside the item. This leads to no thumbnails or wrong thumbnails if the site doesn't include the image in the <content> but do provide it in the <enclosure>.

I think the app would handle the thumbnails better by giving priority to the first <enclosure> (if present), and then using the current method if no <enclosure> is found in the item. The same applies to Atom feeds with the <link rel="enclosure"> element.

For reference, an <enclosure> element can be like this:

<enclosure url="https://github.blog/wp-content/uploads/2024/03/github_copilot_header.png" type="image/png"/>