HenryQW / mercury_fulltext

📖 Enjoy full text for tt-rss.
159 stars 27 forks source link

Add special-case support for Reddit and HN. #21

Closed fancypantalons closed 5 years ago

fancypantalons commented 5 years ago

I wasn't sure if this was of interest to you, but just in case, I figured I'd send it your way. No worries if you don't feel it fits the vision for your plugin!

The Reddit RSS feed is structured such that the element takes you to the Reddit discussion thread, while the element contains an HTML document that contains both a link to Reddit, and a link to the actual article content itself. As a result, this plugin is unable to inline the linked article in the feed (since the element goes to Reddit, not the article).

Hacker News, by contrast, populates the and tags correctly, while also supplying a link to the Hacker News comments in the element, so the plugin works correctly. However, unlike the web interface, the tt-rss mobile app does not provide a way to navigate to the comment URL (yet). Because this plugin replaces the article content, it renders the HN comment link inaccessible on a mobile device.

To work around these two issues, this changeset does three things for Reddit or HN RSS feeds:

First, it attempts to pull the link out of the article content. If it's there, the url element of the article is replaced with the found link. The content is then extracted from the replacement URL, which means the article content is properly inlined into the feed.

Second, it appends a link to the comment thread to the article content itself, so that even on a mobile device, there's a way to get there.

Third, for transparency, the change prepends the source website URL to the article description, so that you can see where the content came from at a glance.

HenryQW commented 5 years ago

Hi thanks for PR.

Unfortunately I can’t merge this into my repo. The purpose is to utilize https://github.com/postlight/mercury-parser and I don’t want to maintain and add extras to it. There are always endless special cases to handle.

I think https://github.com/feediron/ttrss_plugin-feediron potentially does what you intend to achieve.

Also you can try https://github.com/DIYgod/RSSHub for subscribing to websites.

fancypantalons commented 5 years ago

Understood! And thanks for all the hard work, the plugin and mercury parser service have been working wonderfully.

HenryQW commented 5 years ago

You’re welcome! Nice blog post you’ve got there 🥳