Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR]: View message source #377

Closed
Kryptortio opened this issue Mar 7, 2021 · 13 comments
Closed

[FR]: View message source #377

Kryptortio opened this issue Mar 7, 2021 · 13 comments
Assignees
Labels
Component-Core Component-Message-Filters Status-Fixed Ticket is resolved. Type-Enhancement This is request for brand new feature.
Milestone

Comments

@Kryptortio
Copy link
Contributor

Brief description of the feature request.

I would like to have some way to view the source of the message (view xml source rather than the normal preview). I would also like for this to be done in a way so that it can be accessed when writing a filter function (e.g. msg.source).

Why?

I just started using this RSS client and I noticed that the attribute categories is nowhere to be found in the interface (or I have note been able to find it at least). However rather than just requesting this attribute be added (could be a good idea if someone wants to see it in the list). I wanted instead to have some way to see all attributes that are not supported. Primarily I want to use the category attribute for writing filters as it has some information not available to me in the other attributes.

Alternatives

  • Add support for the categories attribute specifically (and maybe more in the future).
  • Add msg.attributes instead of source where each attribute is added in a tree (e.g. msg.attributes.category).
  • Add the full source at the end of the content attribute to be displayed in the preview and used for filtering (could be done as an option to toggle on and off).
  • Add support for custom attributes so that you could globally or for a specific feed add custom attributes under settings that will then be exposed in the filter msg object and in the gui as columns and/or in the preview.
  • Add source/attributes to the msg object but nothing in the gui. If anyone wants to see additional attributes they can add a filter function that appends it to msg.contents.
@Kryptortio Kryptortio added the Type-Enhancement This is request for brand new feature. label Mar 7, 2021
@martinrotter martinrotter added the Status-Invalid Reported bug is not a bug or is not reproducible. label Mar 10, 2021
@martinrotter
Copy link
Owner

martinrotter commented Mar 10, 2021

Hello @maturz. You structured several issues into single ticket, do not do that next time and split your atomic issues into separate tickets. :)

What is attribute categories?

Add msg.attributes instead of source where each attribute is added in a tree - please explain, I am maybe dumb but I really did not catch what you try to say.

Also, MessageObject.contents does of course contain "source code" (HTML/XML) of the contents of the message.

https://github.com/martinrotter/rssguard/blob/master/resources/docs/Message-filters.md#messageobject-class

Or did you mean to have access to FULL XML RSS/ATOM/JSON "node" that represents the single message? Like in the below picture?

image

Btw, to see page source, you can:

image

@martinrotter martinrotter reopened this Mar 10, 2021
@martinrotter martinrotter removed the Status-Invalid Reported bug is not a bug or is not reproducible. label Mar 10, 2021
@Kryptortio
Copy link
Contributor Author

Kryptortio commented Mar 10, 2021

You structured several issues into single ticket, do not do that next time and split your atomic issues into separate tickets.

Sorry they way I saw it was I had one issue with several possible solutions (if one solution is chosen then one issue is is all that's needed but if you would like to implement several then it should probably be split into more issues).

What is attribute categories?

Here is an example of a feed that has it http://renewcanceltv.com/feed/
Also listed here under optional https://validator.w3.org/feed/docs/rss2.html

msg.attributes

This was just one possible way of exposing the data. For example you could then list all non standard data from the xml node here. E.g. attributes.category, attributes.image, attributes.thumbnail or whatever else people decide to put in their feeds (anything RSS Guard isn't using would dynamically get added to attributes).

Or did you mean to have access to FULL XML RSS/ATOM/JSON "node" that represents the single message? Like in the below picture?

Yes when I was talking about source I meant "FULL XML RSS/ATOM/JSON". The core issue is that some feeds have data that I think RSS Guard ignores with no way to use it for filters or viewing it in the client. So most of the other things I wrote were just different ideas for how the problem could be fixed.

@martinrotter
Copy link
Owner

@maturz

Sorry they way I saw it was I had one issue with several possible solutions (if one solution is chosen then one issue is is all that's needed but if you would like to implement several then it should probably be split into more issues).

Yes, I read it again and tweaked my answer, my bad, sorry. :)

Now, I get it. We need to take some more things into account:

  1. RSS Guard contains many service plugins and each of those plugins receives RAW message data in different format. Standard RSS plugin read entry or item XML tags, Inoreader plugin downloads JSON data etc.
  2. You are correct that only some of the XML tags from item (or entry) message tags are processed. RSS Guard extracts title, contents, create date/time, author (and some other data), then it does some magic and saves message into internal database.

That said, I think I could add new MessageObject attribute called rawContents which would include RAW XML/JSON/WHATEVER data for the particular message. But note that these data would be only available when running your message filters and they will NOT be subsequently stored into DB, so you could use the attribute rawContents to do your own filtering logic, and maybe tweak contents or other attributes.

So for example after this is fixed, you would obtain this inside rawContents attribute:

<item>
<title>
‘Dwight in Shining Armor’ Season 6? Cancelled Or Renewed?
</title>
<link>
https://www.renewcanceltv.com/dwight-in-shining-armor-season-6-cancelled-or-renewed/
</link>
<comments>
https://www.renewcanceltv.com/dwight-in-shining-armor-season-6-cancelled-or-renewed/#respond
</comments>
<dc:creator>Renew Cancel</dc:creator>
<pubDate>Tue, 09 Mar 2021 23:26:48 +0000</pubDate>
<category>Cancelled Or Renewed?</category>
<category>dwight in shining armor</category>
<category>BYUtv</category>
<category>Dwight In Shining Armor</category>
<guid isPermaLink="false">https://www.renewcanceltv.com/?p=131381</guid>
<description>
<p>The post <a rel="nofollow" href="https://www.renewcanceltv.com/dwight-in-shining-armor-season-6-cancelled-or-renewed/" data-wpel-link="internal">&#8216;Dwight in Shining Armor&#8217; Season 6? Cancelled Or Renewed?</a> appeared first on <a rel="nofollow" href="https://www.renewcanceltv.com" data-wpel-link="internal">RenewCancelTV</a>.</p>
</description>
<wfw:commentRss>
https://www.renewcanceltv.com/dwight-in-shining-armor-season-6-cancelled-or-renewed/feed/
</wfw:commentRss>
<slash:comments>0</slash:comments>
</item>

Would such a solution be okay for you?

@Kryptortio
Copy link
Contributor Author

Yes, that would let me filter using category so it would solve my problem, if I can also modify the message attributes such as content in a filter then that could make it even more powerful (wasn't sure if I could do that as I tried changing msg.isRead and msg.title without success). There could be benefits to exposing some of this data in the UI as well for sorting or for people not able to write filters but my needs would be met at least :)

@martinrotter
Copy link
Owner

@maturz Of course you can change "contents" attribute already. Thas is the whole point of message filters.

https://github.com/martinrotter/rssguard/blob/master/resources/docs/Message-filters.md (make sure to read it all)

as for "sorting" there is a new "score" attribute which you can use to assign a floating point number to your messages and sort them in message list: #373 (reply in thread)

martinrotter pushed a commit that referenced this issue Mar 10, 2021
@martinrotter martinrotter added this to the 4.0.0 milestone Mar 10, 2021
@martinrotter
Copy link
Owner

OK. I implemented it RN and tested with simple filter to make sure it works. This fix is in version-4 branch and will appear in RSS Guard 4, when it gets released.

You can check here (search for "rawContent") for documentation and I also added example to "Examples" section. Very simple script is:

function filterMessage() {
  console.log(msg.rawContents);
  return MessageObject.Accept;
}

@martinrotter
Copy link
Owner

Note that the JavaScript standard support by the RSS Guard does not include "DomParser" class for parsing XML. To solve the issue, you can "import" your own javascript modules.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#import_an_entire_modules_contents

I also plan to expand the filtering JavaScript environment with some custom "util" methods, perhaps adding method string convertFromXmlToJson(string xml).

@Kryptortio
Copy link
Contributor Author

Cool, thanks. I think I can probably get by doing most things with just some regex. Probably way overkill here but I remember I've used https://www.npmjs.com/package/cheerio before for "serverside dom" parsing/traversing.

@martinrotter
Copy link
Owner

@maturz I am adding "util" built-in functions right now. Wait for it.

@martinrotter
Copy link
Owner

OK, I am almost done, I will commit changes and post some examples tomorrow and close this issue.

@martinrotter
Copy link
Owner

OK, feature is done, I also added "utils" variable with some functions, one of them being ability to convert easily from XML to JSON.

https://github.com/martinrotter/rssguard/blob/version-4/resources/docs/Message-filters.md#utils

martinrotter pushed a commit that referenced this issue May 7, 2021
@fabianski7
Copy link

is this something that can help load content from feeds that hide part of the text?

As with this feed
, the full text is not displayed, and you have to go to the website to do this.

On android, feeder can handle this and displays the entire text.

@sakkamade
Copy link
Contributor

sakkamade commented May 28, 2021

is this something that can help load content from feeds that hide part of the text?

No.

EDIT:
But if you are talking of Message filter in general, try to create the discussion with such request, perhaps it may be done through it.

EDIT2:
Or you can read docs of Message filter and try to create it yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component-Core Component-Message-Filters Status-Fixed Ticket is resolved. Type-Enhancement This is request for brand new feature.
Projects
None yet
Development

No branches or pull requests

4 participants