It is currently March 28th, 2024, 10:36 pm

FeedReader RSS/Atom plugin v2.0 - Atom Support and more!

Share and get help with Plugins and Addons
slartibartfast
Posts: 15
Joined: September 10th, 2012, 3:42 pm

FeedReader RSS/Atom plugin v2.0 - Atom Support and more!

Post by slartibartfast »

Image
When I originally wrote my multiFEED skin its performance was severely diminished by the huge number of regular expressions the skin needed to execute with WebParser to extract the feed data. WebParser's lack of dynamic variable support also greatly complicated the design and execution of MultiFEED 1.0. For multiFEED 2.0 I wrote this plugin.

Rather than struggling with slow and cumbersome regular expressions, this new plugin reads RSS feeds as XML, which is inherently easy for a program (or human) to extract data from. A full RSS feed with fifty or a hundred (or a thousand) headlines can be read over a reasonably fast internet connection in less than one second.

This plugin fully supports dynamic variables, making it easy to write very sophisticated RSS skins with a minimum of fuss. Full documentation is included so you can use the FeedReader plugin in your own skins. If you like it, feel free to use FeedReader in your own released skins. (Creative Commons Attribution-NonCommercial-NoDerivs 3.0 license)

UPDATE: New release version 2.0! Lots of new features added, including:
  • - Atom news feed support!
    - Multiple channel support for RSS feeds.
    - Filter items by age, category, or language.
    - The custom child measure types now support XML attributes and namespaces.
    - New child measure types to provide feed type (RSS or Atom), feed language, and item language.
Version 2.1.0 adds automatic special character substitution, if desired. No more long and complicated Substitute= clauses. Handles 171 different special character codes.

IMPORTANT: I inadvertently uploaded a test version of the DLLs as version 2.1.0, which had special character substitutions disabled for RSS feeds. Sorry about that, it's what happens when you upload things when you are suffering the worst flu you've had in ten years. Version 2.1.1 fixes this. It also extends the ItemDesc child measure type to return the value of the item <content> nodes for Atom feeds. I recommend all FeedReader users upgrade to the latest version.

Download it now from my deviantART gallery. http://LimeyCanuck.deviantart.com
Last edited by slartibartfast on January 1st, 2013, 6:06 pm, edited 9 times in total.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: New high-performance RSS feed reader plugin

Post by jsmorley »

Seems to work pretty well. Nice job.

Without the date/time of the item being available in some standard date format it wouldn't be something I could regularly use, as I like to have new items (new by my definition in seconds or minutes) highlighted. (I bring the raw data into Lua to do some extra parsing and actions there) Having said that, for most pretty simple RSS needs, I think this is quite good and may well meet the needs of many folks. Being able to avoid complex regular expressions is certainly going to be welcome to many.

I didn't test, but I assume this will handle both RSS and Atom feed formats?
slartibartfast
Posts: 15
Joined: September 10th, 2012, 3:42 pm

Re: New high-performance RSS feed reader plugin

Post by slartibartfast »

jsmorley wrote:Seems to work pretty well. Nice job.

Without the date/time of the item being available in some standard date format it wouldn't be something I could regularly use, as I like to have new items (new by my definition in seconds or minutes) highlighted. (I bring the raw data into Lua to do some extra parsing and actions there) Having said that, for most pretty simple RSS needs, I think this is quite good and may well meet the needs of many folks. Being able to avoid complex regular expressions is certainly going to be welcome to many.

I didn't test, but I assume this will handle both RSS and Atom feed formats?
Good point. I don't use date/time values myself, but I can see how they would be useful to others. I'll add this to the child measure types. Might even be today. :D

As for the RSS/Atom question, I don't know. I designed it for RSS feeds, and I don't know the Atom feed format, but I'll look into this too.

UPDATE: I'm also going to add feed language, and item categories to the child measure types. I think I can also create a special child type that allow extraction of user defined XML nodes. Check back in a day or two for version 1.0.1.

UPDATE2: So much was added that I bumped the new version up to 1.1.0... adds everything you mentioned except Atom feed support. On my deviantART gallery page now.
User avatar
thatsIch
Posts: 446
Joined: August 7th, 2012, 9:18 pm

Re: FeedReader RSS/Atom plugin v2.0 - Atom Support and more

Post by thatsIch »

wondering, does this support Lua?
€: tested it and it works like any normal Measure, though wished it would have any advanced Lua support like own functions to work with that, since in the end Lua is still far more easy to handle than using this plugin. You just need one webparser to download the file and the lua to parse it and process it directly. With that you just need one measure.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: FeedReader RSS/Atom plugin v2.0 - Atom Support and more

Post by jsmorley »

thatsIch wrote:wondering, does this support Lua?
€: tested it and it works like any normal Measure, though wished it would have any advanced Lua support like own functions to work with that, since in the end Lua is still far more easy to handle than using this plugin. You just need one webparser to download the file and the lua to parse it and process it directly. With that you just need one measure.
I think this is an alternative to using Lua in that way, not something that it makes sense to integrate with Lua in any way. While it is true that one method of parsing a feed is to download the entire site with RegExp=(?siU)^(*)$ and parse it in Lua, one that I use myself on just about every WebParser skin, it has some disadvantages as Lua can't handle Unicode characters, so any feed that is in a non-Latin character set is going to be impossible to do this way.

I don't understand how any attempt to integrate this plugin with Lua (real integration is just not possible) or what "functions" supporting Lua make any sense. You certainly can still get the value of any "child" measures created with the plugin in Lua, and do additional processing if you want or need.

I think if a user wants to use Lua to parse a site, that is fine. In fact, I encourage it. If not, if the user isn't interested in learning Lua, or wants to ensure that Unicode is supported, then I think this plugin is really full-featured and does everything it needs.
User avatar
thatsIch
Posts: 446
Joined: August 7th, 2012, 9:18 pm

Re: FeedReader RSS/Atom plugin v2.0 - Atom Support and more

Post by thatsIch »

True, the main drawback is the lacking Unicode support. Forgot about that.
clefranc
Posts: 1
Joined: December 13th, 2017, 12:33 pm

Re: FeedReader RSS/Atom plugin v2.0 - Atom Support and more!

Post by clefranc »

Hi,
Can you help me get the <summary> item for the below Atom feed?
I need : Émis à: 04h51 HNE mercredi 13 décembre 2017

Thanks

Christian

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
 <feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr-ca">
 
<!--
Ce fichier contient des données destinées aux lecteurs ou agrégateurs RSS.
Pour en apprendre davantage au sujet du service RSS, veuillez vous rendre à http://www.ec.gc.ca/meteo-weather/default.asp?lang=Fr&n=11703207-1
-->

 <title>Fermont - Alerte Météo - Environnement Canada</title>
 <link rel="related" href="http://www.meteo.gc.ca/warnings/report_f.html?qc3" type="text/html"/>
 <link rel="self" href="http://www.meteo.gc.ca/rss/battleboard/qc3_f.xml" type="application/atom+xml"/>
 <link rel="alternate" hreflang="en-ca" href="http://www.weather.gc.ca/rss/battleboard/qc3_e.xml" type="application/atom+xml"/>
 <author>
 <name>Environnement Canada</name>
 <uri>http://www.meteo.gc.ca</uri>
 </author>
 <updated>2017-12-13T09:54:38Z</updated>
 <id>tag:meteo.gc.ca,2013-04-16:20171213095438</id>
 <logo>http://www.meteo.gc.ca/template/gcweb/v4.0.24/assets/wmms-alt.png</logo>
 <icon>http://www.meteo.gc.ca/template/gcweb/v4.0.24/assets/favicon.ico</icon>
 <rights>Droit d'auteur 2017, Environnement Canada</rights>
 <entry>
 <title>AVERTISSEMENT DE TEMPÊTE HIVERNALE EN VIGUEUR, Fermont</title>
 <link type="text/html" href="http://www.meteo.gc.ca/warnings/report_f.html?qc3"/>
 <updated>2017-12-13T09:51:00Z</updated>
 <published>2017-12-13T09:51:00Z</published>
 <category term="Alertes"/>
 <summary type="html">Émis à: 04h51 HNE mercredi 13 décembre 2017</summary>
 <id>tag:meteo.gc.ca,2013-04-16:qc3_w1:201712130951</id>
 </entry>
 </feed>
slartibartfast
Posts: 15
Joined: September 10th, 2012, 3:42 pm

Re: FeedReader RSS/Atom plugin v2.0 - Atom Support and more!

Post by slartibartfast »

Hello Christian... It's been years since I wrote this plugin so my memory might be faulty, but you should be able to get what you need with the ItemCustom measure.

Code: Select all

[MeasureItemSummary]
Measure=Plugin
Plugin=FeedReader
Parent=MeasureAtomParent
Type=ItemCustom
Path=summary
The "Path" value for ItemCustom measures is relative to the "/feed/entry" node so you only need to specify "summary" for Path.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: FeedReader RSS/Atom plugin v2.0 - Atom Support and more!

Post by Yincognito »

slartibartfast wrote: December 21st, 2012, 12:41 amRather than struggling with slow and cumbersome regular expressions, this new plugin reads RSS feeds as XML, which is inherently easy for a program (or human) to extract data from. A full RSS feed with fifty or a hundred (or a thousand) headlines can be read over a reasonably fast internet connection in less than one second.
Well, they might be slow compared to the alternatives, but to me, they are only cumbersome at times when it comes to deciphering a longer pattern that someone else wrote, otherwise they're relatively easy to build. But yeah, it takes a bit more than one second (and usage) to get 140 headlines from 7 feeds like my WebParser + RegExp feeds skin from my suite is currently doing (without Lua though).

I was curious to compare how your plugin fares in regard to my method and see if items can be automatically sorted by datetime, and even though it seems to be well done and documented (great job, by the way!), it crashes Rainmeter if I uncomment what is commented below (I'm testing your 2.3.0 version from DeviantArt):

Code: Select all

[Variables]

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

---Measures---

[Feed]
Measure=Plugin
Plugin=FeedReader
UpdateDivider=-1
URL=http://rss.cnn.com/rss/edition.rss

[FeedTitle]
Measure=Plugin
Plugin=FeedReader
Parent=Feed
Type=FeedTitle

[FeedLink]
Measure=Plugin
Plugin=FeedReader
Parent=Feed
Type=FeedLink

[FeedLanguage]
Measure=Plugin
Plugin=FeedReader
Parent=Feed
Type=FeedLanguage

[FeedImageTitle]
Measure=Plugin
Plugin=FeedReader
Parent=Feed
Type=FeedImageTitle

[FeedImageURL]
Measure=Plugin
Plugin=FeedReader
Parent=Feed
Type=FeedImageURL

[FeedImageLink]
Measure=Plugin
Plugin=FeedReader
Parent=Feed
Type=FeedImageLink

[FeedCustomLastBuildDate]
Measure=Plugin
Plugin=FeedReader
Parent=Feed
Type=FeedCustom
Path=lastBuildDate

[FeedItemCount]
Measure=Plugin
Plugin=FeedReader
Parent=Feed
Type=ItemCount

[FeedItem1Title]
Measure=Plugin
Plugin=FeedReader
Parent=Feed
Type=ItemTitle
ItemNum=1

[FeedItem1Link]
Measure=Plugin
Plugin=FeedReader
Parent=Feed
Type=ItemLink
ItemNum=1

[FeedItem1Language]
Measure=Plugin
Plugin=FeedReader
Parent=Feed
Type=ItemLanguage
ItemNum=1

[FeedItem1Description]
Measure=Plugin
Plugin=FeedReader
Parent=Feed
Type=ItemDesc
ItemNum=1

[FeedItem1Categories]
Measure=Plugin
Plugin=FeedReader
Parent=Feed
Type=ItemCategories
ItemNum=1

[FeedItem1PubDate]
Measure=Plugin
Plugin=FeedReader
Parent=Feed
Type=ItemPubDate
ItemNum=1

; [FeedItem1PubDateSortable]
; Measure=Plugin
; Plugin=FeedReader
; Parent=Feed
; Type=ItemPubDateSortable
; ItemNum=1

; [FeedItem1Age]
; Measure=Plugin
; Plugin=FeedReader
; Parent=Feed
; Type=ItemAge
; ItemNum=1

[FeedItem1CustomGUID]
Measure=Plugin
Plugin=FeedReader
Parent=Feed
Type=ItemCustom
ItemNum=1
Path=guid

---Styles---

[MeterStyle]
FontFace=Tahoma
FontSize=10
FontColor=255,255,255,255
SolidColor=0,0,0,255
X=0
Y=0R

---Meters---

[Background]
Meter=Image
W=600
H=300
SolidColor=0,0,0,128
UpdateDivider=-1

[FeedTitleText]
Meter=String
MeterStyle=MeterStyle
Y=0r
MeasureName=FeedTitle
Text=%1
DynamicVariables=1

[FeedLinkText]
Meter=String
MeterStyle=MeterStyle
MeasureName=FeedLink
Text=%1
DynamicVariables=1
Shouldn't it silently fail and provide blank data is there was any problem with finding or converting datetimes to UTC (if by any chance, that is the cause of the crash)? Which brings up one of the disadvantages of using something else than WebParser + RegExp in these cases: if something doesn't work, you can't fix it ASAP yourself, you have to wait for someone else to do it.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth