i thought it would be nice to know the number of notifications, just like <fullcount>(.*)</fullcount> in the GMail inbox feed. as there no such info provided, i thought i'd just count the number of items in the feed. this means i fetch the whole feed and then use a few substitions:
the first four substitions eradicate linebreaks, tabs and other whitespace, the next one eradicates everything before the items start. then everything between <item></item> tags gets removed and also everything after the items end.
what is left is a chain of <item></item><item></item><item></item><item></item>...<item></item>
so let's replace <item> with 1 and </item> with +. to avoid a syntax error, let's replace the the last + with +0.
just in case there are no items in the feed, nothing (^$) gets replaced with 0.
what is left is a chain of 1+1+1+...+1+0. use that as formula in a calc measure. done.
Code: Select all
[MeasureFacebookCountBase]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=#FacebookNotificationFeed#
RegExp="(?siU)^(.*)$"
StringIndex=1
RegExpSubstitute=1
Substitute="\r":"","\n":"","\t":"","\s":"","^(.*?)</webMaster>":"","<item>(.*?)</item>":"<item></item>","^(.*)</channel>(.*?)$":"\1","<item>":"1","</item>":"+","^(.+)$":"\10","^$":"0"
Disabled=1
FinishAction=[!SetOption MeasureFacebookCountAll Formula "[MeasureFacebookCountBase]" "#CURRENTCONFIG#"][!UpdateMeasure MeasureFacebookCountAll][!DisableMeasure MeasureFacebookCountBase]
[MeasureFacebookCountAll]
Measure=Calc
Formula=(0)
DynamicVariables=1
warning: this is heavy on cpu use, depending on the length of the feed. that's why i have it disabled. i enable/update it with a FinishAction when the regular Facebook feed reader measure is done. it gets disabled again when it did it's job.
so, i hope that gives you ideas on counting items in a feed. with a few modifications and the new dynamic webparser plugin, you can use variables either in the RegExp or in the substitutions to eliminate larger parts of the feed and only count new items for example. or items for today only. etc.