It is currently March 28th, 2024, 9:20 am

Help with parsing html

Get help with creating, editing & fixing problems with skins
TimmyT1983
Posts: 12
Joined: December 22nd, 2020, 10:39 pm

Re: Help with parsing html

Post by TimmyT1983 »

The second text is the exact return value, no html, just that text. I ended up getting everything from that return value (unparsed) displayed in rainmeter but if you know how to parse and display it i'm interested!
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm
Contact:

Re: Help with parsing html

Post by SilverAzide »

TimmyT1983 wrote: December 24th, 2020, 12:49 am The second text is the exact return value, no html, just that text. I ended up getting everything from that return value (unparsed) displayed in rainmeter but if you know how to parse and display it i'm interested!
I'm not all that savvy at regexps, but try the following in your main [MeasureSite] measure:

Code: Select all

RegExp=(?siU){.*{.*:"(.*)".*:{".*":(.*),.*:(.*),.*:(.*)},.*:"(.*)"}}
The captures should look like this:

1 => 2020-12-23T04:05:36
2 => 79.0
3 => 30.8
4 => 45.5
5 => F

So just set the index on the child WebParser measures to whichever data items you want. I just guessed at what you are looking to return, you can grab anything in that string that you want.
User avatar
Youkai1977
Posts: 164
Joined: October 31st, 2018, 4:11 pm
Location: Germany

Re: Help with parsing html

Post by Youkai1977 »

I hope I may hang myself with my problem here simply times ... :) :oops:

I am editing the WebParser-Measure of my NewsFeed-Skin.
I would like to add the RegEx that the <lastBuildDate> is read, as well as optimize the RegEx in general, as it can be read here -> https://docs.rainmeter.net/tips/rss-feed-tutorial/.
I would like to read out the <lastBuildDate> at the portal "GOOGLE NEWS" https://news.google.com/rss?pz=1&cf=all&hl=de&gl=DE&ceid=DE:de.

I have now read through various help on the net to the RegEx to this, but I must admit to myself, this is too high for me. I am not stupid, but that ... no plan. O.O :???:
What confuses me above all is that if I use in the net e.g. RegEx-Generators, these tell me then, I have it correctly, it does NOT work however if I try this then in the Program RainRegExp, then an error receives.
In short, for laymen really not easy to look through it.

Simple is that if I want to have the whole string. Then it needs only <lastBuildDate>(.*)</lastBuildDate>.
But I do NOT want the whole string, but ONLY: "Example:" 30 Mar 09:55:35

The Tue, as well as the GMT should be filtered out.

I have it now thanks to RainRegExp so <lastBuildDate>.*(.{0,21})...</lastBuildDate> and the result is as desired ... so ONLY 30 Mar 09:55:35 instead of Tue, 30 Mar 09:55:35 GMT.
But I'm getting the feeling like I've solved it too complicated. :uhuh:
Am I right with my suspicion, or do I have it (according to the motto, a blind hen also finds a grain) actually right?
RegEx-Example.png
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with parsing html

Post by balala »

Youkai1977 wrote: March 30th, 2021, 11:47 am Simple is that if I want to have the whole string. Then it needs only <lastBuildDate>(.*)</lastBuildDate>.
But I do NOT want the whole string, but ONLY: "Example:" 30 Mar 09:55:35
I'd get the date and time as is it returned by the site, then would use a Time measure, to can convert the date and time to any desired format.
Here is an example. I used an extremely simple WebParser measure:

Code: Select all

[MeasureRainmeter]
Measure=WebParser
UpdateRate=870
Url=https://news.google.com/rss?pz=1&cf=all&hl=de&gl=DE&ceid=DE:de
RegExp=(?siU)<lastBuildDate>(.*)</lastBuildDate>
FinishAction=[!EnableMeasure "MeasureLastBuildwFormated"][!UpdateMeasure "MeasureLastBuildwFormated"]
DecodeCharacterReference=3
StringIndex=1
As you can see, the FinishAction option of this measure is enabling and updating a measure called [MeasureLastBuildwFormated], which has not been posted so far. So add it:

Code: Select all

[MeasureLastBuildwFormated]
Measure=Time
Format=%d %b %H:%M:%S
TimeStamp=[MeasureRainmeter]
TimeStampFormat=%a, %d %b %Y %H:%M:%S GMT
DynamicVariables=1
Disabled=1
See that this measure is a disabled Time measure. It has to be disabled to avoid the error messages in the log. When the [MeasureRainmeter] parent WebParser measure gets its value, the FinishAction option enables and updates the [MeasureLastBuildwFormated], so you get the appropriate result retuned by this measure.
Obviously you can freely modify the Format option of the measure, to get the appropriate format.
User avatar
Youkai1977
Posts: 164
Joined: October 31st, 2018, 4:11 pm
Location: Germany

Re: Help with parsing html

Post by Youkai1977 »

balala wrote: March 30th, 2021, 6:20 pm I'd get the date and time as is it returned by the site, then would use a Time measure, to can convert the date and time to any desired format.
Here is an example. I used an extremely simple WebParser measure:

Code: Select all

[MeasureRainmeter]
Measure=WebParser
UpdateRate=870
Url=https://news.google.com/rss?pz=1&cf=all&hl=de&gl=DE&ceid=DE:de
RegExp=(?siU)<lastBuildDate>(.*)</lastBuildDate>
FinishAction=[!EnableMeasure "MeasureLastBuildwFormated"][!UpdateMeasure "MeasureLastBuildwFormated"]
DecodeCharacterReference=3
StringIndex=1
As you can see, the FinishAction option of this measure is enabling and updating a measure called [MeasureLastBuildwFormated], which has not been posted so far. So add it:

Code: Select all

[MeasureLastBuildwFormated]
Measure=Time
Format=%d %b %H:%M:%S
TimeStamp=[MeasureRainmeter]
TimeStampFormat=%a, %d %b %Y %H:%M:%S GMT
DynamicVariables=1
Disabled=1
See that this measure is a disabled Time measure. It has to be disabled to avoid the error messages in the log. When the [MeasureRainmeter] parent WebParser measure gets its value, the FinishAction option enables and updates the [MeasureLastBuildwFormated], so you get the appropriate result retuned by this measure.
Obviously you can freely modify the Format option of the measure, to get the appropriate format.
Hi, Thanks for your tip / idea. :thumbup:

Almost exactly so I had it yesterday in my skin also already in had.
But I noticed that the timestamp is manipulated by the TIME-Measure in the output.

EXAMPLE:
<LastBuildDate> has the Time-Value 05:49:33 and the REAL current time is, say 07:59:18.
Then the result will show 05:59:18.

So the hour of <LastBuildDate> 5, but the minutes and seconds 59:18 of the real current time.

And if I do it as in your tip (which as I said is very similar to my implementation yesterday), I have EXACTLY the same problem.

See the Screenshots:
Unbenannt.png
Unbenannt2.png
LAST NFR-UPD: is the Time who the Skin ist Updated per [mRSS]-Measure (my other Problem from the other Thread ...you now?!)
LAST NFP-BUILD: Is the Time from the Website when the Time-Measure manipulated the <lastBuildDate>

But i don`t now why? :???: :confused: :uhuh:
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with parsing html

Post by balala »

Youkai1977 wrote: April 1st, 2021, 6:10 am EXAMPLE:
<LastBuildDate> has the Time-Value 05:49:33 and the REAL current time is, say 07:59:18.
Then the result will show 05:59:18.

So the hour of <LastBuildDate> 5, but the minutes and seconds 59:18 of the real current time.
This is a little bit weird, but I suppose your code is manipulating somehow the time. Please post the whole code, to can see what's going on there.
User avatar
Youkai1977
Posts: 164
Joined: October 31st, 2018, 4:11 pm
Location: Germany

Re: Help with parsing html

Post by Youkai1977 »

balala wrote: April 1st, 2021, 5:18 pm This is a little bit weird, but I suppose your code is manipulating somehow the time. Please post the whole code, to can see what's going on there.
That this is a little strange, I can only agree. But so it goes me since the end of January yes soon with every skin I have since then started to code. Nothing works more on the first go. :uhuh:

But well, here is the code...

1.) newsfeed.ini

Code: Select all

[Rainmeter]
Update=20
DefaultUpdateDivider=50
AccurateText=1
DynamicWindowSize=1

[Metadata]
Name=NewsFeed Reader (Marquee)
Author=Youkai1977 
Version=03-21.V1 <> 30.03.2021
Information=This Meter is a Part of M.A.R.S.- 2021 Skin Package
License=Creative Commons Attribution-Non-Commercial-Share Alike 4.0

;==================================================
;=== VARIABLES & STYLES ===========================
;==================================================

[Variables]
@include=newsfeeddata.inc

;==============================================================
;=== VOICE OUTPUT =============================================
;==============================================================
;===                                                         ==
;=== FOR MORE INFO TO SPEECH-PLUGIN                          ==
;=== https://forum.rainmeter.net/viewtopic.php?f=127&t=31161 ==
;===                                                         ==
;==============================================================

[VoiceOutput]
Measure=PLUGIN
Plugin=Speech
Name=#VoiceName#
;Index=#IndexName# 
;Gender=#VoiceGender#
Debug=#DebugModus#
Volume=#VoiceVolume#
Rate=#SpeechRate#
UpdateDivider=-1

;==================================================
;=== MEASURES NEWS FEED & MARQUEE =================
;==================================================

;=== MEASURES NEWS FEED ===========================

[mRSS]
Measure=WEBPARSER
URL=#RSSUrl#
RegExp=(?siU)<lastBuildDate>(.*)</lastBuildDate>.*<description>(.*)</description>#NF1#(?(?=.*<item)#NF2##NF3##NF4##NF5#)
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
DecodeCharacterReference=3
UpdateRate=1200
StringIndex=1
Debug=1
OnChangeAction=[!EnableMeasureGroup mCHILDS][!UpdateMeasure mNFRUpdateTime][!SetOption HEADNAME FontColor "#Color4##Alpha1#"][!UpdateMeter HEADNAME][!ShowMeter HEADNAME][!UpdateMeterGroup FEED][!Redraw]
FinishAction=[!EnableMeasure mLBTSF][!UpdateMeasure mLBTSF][!UpdateMeterGroup FEED][!Redraw][!CommandMeasure VoiceOutput "#NewsUpdSpeech#"][!ShowMeter NewsFeed][!EnableMeasure mXPos][!UpdateMeasure mXPos][!Delay 4000][!SetOption HEADNAME FontColor "#Color3##Alpha1#"][!UpdateMeter HEADNAME][!Redraw]

[mRSSNPN]
Measure=WEBPARSER
URL=[mRSS]
StringIndex=2
Disabled=1
Group=mCHILDS

[mRSSItem1]
Measure=WEBPARSER
URL=[mRSS]
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
StringIndex=3
Disabled=1
Group=mCHILDS

[mRSSItem2]
Measure=WEBPARSER
URL=[mRSS]
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
StringIndex=4
Disabled=1
Group=mCHILDS

[mRSSItem3]
Measure=WEBPARSER
URL=[mRSS]
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
StringIndex=5
Disabled=1
Group=mCHILDS

[mRSSItem4]
Measure=WEBPARSER
URL=[mRSS]
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
StringIndex=6
Disabled=1
Group=mCHILDS

[mRSSItem5]
Measure=WEBPARSER
URL=[mRSS]
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
StringIndex=7
Disabled=1
Group=mCHILDS

;=== MEASURE NFR-SKIN-UPDATE TIME STAMP (mNFRUT) ==
;=== MEASURE NFR-SITE-BUILD  TIME STAMP (mLBTSF) ==

[mNFRUT]
Measure=TIME
Format=%d.%m.%Y [\x00B7] %H:%M:%S
TimeStampLocale=#TSL#
FormatLocale=#FL#
UpdateDivider=-1
Disabled=1
Group=mCHILDS

[mLBTSF]
Measure=TIME
Format=%d.%m.%Y [\x00B7] %H:%M:%S
TimeStamp=[mRSS]
TimeStampFormat=%a, %d %b %Y %H:%M:%S GMT
DynamicVariables=1
Disabled=1

;=== MEASURE MARQUEE FUNCTION =====================

[mXPos]
Measure=LOOP
StartValue=#StartPos#
EndValue=-[NewsFeed:W]
Increment=#Direction#
LoopCount=0
DynamicVariables=1
UpdateDivider=1
Disabled=1

;##################################################
;##################################################
;##################################################
;##################################################
;##################################################
;##################################################

;==================================================
;=== LAYER POS. & LAST NFR-UPD LINE ===============
;==================================================

[LAYERxPosText]
Meter=STRING
MeterStyle=StLAYER
X=0
Y=0

[NFRUpdText]
Meter=STRING
MeterStyle=StNFRUPDATE
X=200
Y=r

;==================================================
;=== HEAD NEWS FEED READER (Side Lines) ===========
;==================================================

[HEADLINES]
Meter=SHAPE
X=0
Y=20
Shape=Rectangle 0,0,8,8 | Extend ModifiersS1
Shape2=Line 8,4,26,4 | Extend ModifiersL1
Shape3=Rectangle 26,0,8,8 | Extend ModifiersS1
;-----
Shape4=Rectangle 0,16,8,8 | Extend ModifiersS2
Shape5=Line 8,20,26,20 | Extend ModifiersL2
Shape6=Rectangle 26,16,8,8 | Extend ModifiersS2
;-----
Shape7=Rectangle ([HEADNAME:W] + 48),0,8,8 | Extend ModifiersS1
Shape8=Rectangle ([HEADNAME:W] + 48),0,8,8 | Extend ModifiersS1
Shape9=Rectangle ([HEADNAME:W] + 48),16,8,8 | Extend ModifiersS2
Shape10=Rectangle ([HEADNAME:W] + 48),16,8,8 | Extend ModifiersS2
;-----
Shape11=Rectangle 872,0,8,8 | Extend ModifiersS1
Shape12=Line 854,4,872,4 | Extend ModifiersL1
Shape13=Rectangle 846,0,8,8 | Extend ModifiersS1
;-----
Shape14=Rectangle 872,16,8,8 | Extend ModifiersS2
Shape15=Line 854,20,872,20 | Extend ModifiersL2
Shape16=Rectangle 846,16,8,8 | Extend ModifiersS2
ModifiersS1=StrokeWidth 0 | Fill Color #Color3##Alpha2#
ModifiersL1=StrokeWidth 2 | StrokeColor #Color3##Alpha2#
ModifiersS2=StrokeWidth 0 | Fill Color #Color3##Alpha1#
ModifiersL2=StrokeWidth 2 | StrokeColor #Color3##Alpha1#
DynamicVariables=1
UpdateDivider=-1
Group=FEED

[HEADNAME]
Meter=STRING
MeterStyle=StHEAD
X=41
Y=r
MouseOverAction=[!SetOption HEADNAME FontColor "#Color4##Alpha1#"][!UpdateMeter HEADNAME][!Redraw]
MouseLeaveAction=[!SetOption HEADNAME FontColor "#Color3##Alpha1#"][!UpdateMeter HEADNAME][!Redraw]
LeftMouseUpAction=[#vURL#]

;==================================================
;=== MARQUEE NEWS FEED READER =====================
;==================================================

;=== CONTAINER NEWS FEED ==========================

[CONTAINER_NFR]
Meter=SHAPE
X=0
Y=r
Shape=Line ([HEADNAME:W] + 63),0,839,0 | StrokeWidth 47 | StrokeColor #Color0##Alpha1#
DynamicVariables=1
UpdateDivider=-1
LeftMouseDoubleClickAction=[#vURL#]
Group=FEED

;=== MARQUEE NEWS FEED ============================

[NewsFeed]
Meter=STRING
MeterStyle=StNEWS
X=[mXPos]r
Y=r
2.) newsfeeddata.inc

Code: Select all

[Variables]
;********************************************************************************************************************************************************
;********************************************************************************************************************************************************
;***                                                                                                                                               ******
;*** !!!!!!!!!!!!!!!!!!   DON`T CHANGE ANYTHING IN THIS FILE   !!!!!!!!!!!!!!!!!!!!!!!   Unless you know what you are doing :-) !!!!!!!!!!!!!!!!!! ******
;*** !!!!!!!!!!!!!!!!!!   DON`T CHANGE ANYTHING IN THIS FILE   !!!!!!!!!!!!!!!!!!!!!!!   Unless you know what you are doing :-) !!!!!!!!!!!!!!!!!! ******
;*** !!!!!!!!!!!!!!!!!!   DON`T CHANGE ANYTHING IN THIS FILE   !!!!!!!!!!!!!!!!!!!!!!!   Unless you know what you are doing :-) !!!!!!!!!!!!!!!!!! ******
;*** !!!!!!!!!!!!!!!!!!   DON`T CHANGE ANYTHING IN THIS FILE   !!!!!!!!!!!!!!!!!!!!!!!   Unless you know what you are doing :-) !!!!!!!!!!!!!!!!!! ******
;***                                                                                                                                               ******
;********************************************************************************************************************************************************
;********************************************************************************************************************************************************
;==================================================
;=== VARIABLES FONTFACE - SIZE - COLORS ===========
;==================================================
FontFace=SQUARE721 BT
FS1=10
FS2=8
Alpha0=1
Alpha1=255
Alpha2=70
Color0=0,0,0,
Color1=160,246,253,
Color2=48,180,200,
Color3=97,240,255,
Color4=253,193,0,
Color5=255,255,255
Color6=255,104,67,
;==================================================
;=== VARIABLES SPEECH PLUGIN (NewsFeed) ===========
;==================================================
VoiceName=Microsoft Hedda Desktop
;IndexName= 
;VoiceGender=
DebugModus=0
VoiceVolume=100
SpeedRate=-2
NewsUpdSpeech=News Feed aktualisiert
;==================================================
;=== VARIABLES NEWS FEED READER ===================
;==================================================
Direction=-1
StartPos=850
RSSUrl=https://news.google.com/rss?pz=1&cf=all&hl=de&gl=DE&ceid=DE:de
vURL=http://news.google.de/
NF1=.*<item.*<title.*>(.*)</title>.*
NF2=.*<title.*>(.*)</title>
NF3=.*<title.*>(.*)</title>
NF4=.*<title.*>(.*)</title>
NF5=.*<title.*>(.*)</title>
TSL=de-DE
FL=de-DE
;==================================================
;=== STYLE NEWS FEED HEAD (Side Line) =============
;==================================================

[StLAYER]
Padding=0,-3,-1,-3
SolidColor=#Color0##Alpha0#
FontColor=#Color1##Alpha1#
FontFace=#FontFace#
FontSize=#FS2#
StringCase=UPPER
AntiAlias=1
Text=LAYER NFR   POS: [NewsFeed:Y] [\x00B7] [mXPos]
InlineSetting=Color | #Color6##Alpha1#
InlinePattern=[NewsFeed:Y]
InlineSetting2=Color | #Color4##Alpha1#
InlinePattern2=[\x00B7](.*)
DynamicVariables=1
UpdateDivider=1
Group=FEED

[StNFRUPDATE]
Padding=0,-3,-1,-3
SolidColor=#Color0##Alpha0#
FontColor=#Color1##Alpha1#
FontFace=#FontFace#
FontSize=#FS2#
StringCase=UPPER
AntiAlias=1
Text=LAST NFR-UPD: [mNFRUT] [\x2022] LAST NFP-BUILD: [mLBTSF]
InlineSetting=Color | #Color6##Alpha1#
InlinePattern=[mNFRUT] | [mLBTSF]
DynamicVariables=1
UpdateDivider=-1
Group=FEED

[StHEAD]
Padding=0,4,-1,5
SolidColor=#Color0##Alpha0#
FontColor=#Color3##Alpha1#
FontFace=#FontFace#
FontSize=#FS1#
StringCase=UPPER
AntiAlias=1
Text=[mRSSNPN]
ClipString=2
ClipStringW=105
ClipStringH=15
DynamicVariables=1
UpdateDivider=-1
Hidden=1

;==================================================
;=== STLYE NEWS FEED ==============================
;==================================================

[StNEWS]
Padding=0,4,-1,5
SolidColor=#Color0##Alpha0#
FontColor=#Color5##Alpha1#
FontFace=#FontFace#
FontSize=#FS1#
StringCase=UPPER
AntiAlias=1
Text=[\x2022][\x2022][\x2022]  [mRSSItem1]  [\x2022][\x2022][\x2022]  [mRSSItem2]  [\x2022][\x2022][\x2022]  [mRSSItem3]  [\x2022][\x2022][\x2022]  [mRSSItem4]  [\x2022][\x2022][\x2022]  [mRSSItem5]  [\x2022][\x2022][\x2022] 
InlineSetting=Color | #Color1##Alpha1#
InlinePattern=(?i)[mRSSItem1] | (?i)[mRSSItem3] | (?i)[mRSSItem5]
InlineSetting2=Color | #Color2##Alpha1#
InlinePattern2=(?i)[mRSSItem2] | (?i)[mRSSItem4]
DynamicVariables=1
UpdateDivider=1
Hidden=1
Container=CONTAINER_NFR
Group=FEED
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with parsing html

Post by balala »

Youkai1977 wrote: April 2nd, 2021, 5:48 am But well, here is the code...

1.) newsfeed.ini

Code: Select all

[Rainmeter]
Update=20
DefaultUpdateDivider=50
AccurateText=1
DynamicWindowSize=1

[Metadata]
Name=NewsFeed Reader (Marquee)
Author=Youkai1977 
Version=03-21.V1 <> 30.03.2021
Information=This Meter is a Part of M.A.R.S.- 2021 Skin Package
License=Creative Commons Attribution-Non-Commercial-Share Alike 4.0

;==================================================
;=== VARIABLES & STYLES ===========================
;==================================================

[Variables]
@include=newsfeeddata.inc

;==============================================================
;=== VOICE OUTPUT =============================================
;==============================================================
;===                                                         ==
;=== FOR MORE INFO TO SPEECH-PLUGIN                          ==
;=== https://forum.rainmeter.net/viewtopic.php?f=127&t=31161 ==
;===                                                         ==
;==============================================================

[VoiceOutput]
Measure=PLUGIN
Plugin=Speech
Name=#VoiceName#
;Index=#IndexName# 
;Gender=#VoiceGender#
Debug=#DebugModus#
Volume=#VoiceVolume#
Rate=#SpeechRate#
UpdateDivider=-1

;==================================================
;=== MEASURES NEWS FEED & MARQUEE =================
;==================================================

;=== MEASURES NEWS FEED ===========================

[mRSS]
Measure=WEBPARSER
URL=#RSSUrl#
RegExp=(?siU)<lastBuildDate>(.*)</lastBuildDate>.*<description>(.*)</description>#NF1#(?(?=.*<item)#NF2##NF3##NF4##NF5#)
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
DecodeCharacterReference=3
UpdateRate=1200
StringIndex=1
Debug=1
OnChangeAction=[!EnableMeasureGroup mCHILDS][!UpdateMeasure mNFRUpdateTime][!SetOption HEADNAME FontColor "#Color4##Alpha1#"][!UpdateMeter HEADNAME][!ShowMeter HEADNAME][!UpdateMeterGroup FEED][!Redraw]
FinishAction=[!EnableMeasure mLBTSF][!UpdateMeasure mLBTSF][!UpdateMeterGroup FEED][!Redraw][!CommandMeasure VoiceOutput "#NewsUpdSpeech#"][!ShowMeter NewsFeed][!EnableMeasure mXPos][!UpdateMeasure mXPos][!Delay 4000][!SetOption HEADNAME FontColor "#Color3##Alpha1#"][!UpdateMeter HEADNAME][!Redraw]

[mRSSNPN]
Measure=WEBPARSER
URL=[mRSS]
StringIndex=2
Disabled=1
Group=mCHILDS

[mRSSItem1]
Measure=WEBPARSER
URL=[mRSS]
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
StringIndex=3
Disabled=1
Group=mCHILDS

[mRSSItem2]
Measure=WEBPARSER
URL=[mRSS]
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
StringIndex=4
Disabled=1
Group=mCHILDS

[mRSSItem3]
Measure=WEBPARSER
URL=[mRSS]
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
StringIndex=5
Disabled=1
Group=mCHILDS

[mRSSItem4]
Measure=WEBPARSER
URL=[mRSS]
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
StringIndex=6
Disabled=1
Group=mCHILDS

[mRSSItem5]
Measure=WEBPARSER
URL=[mRSS]
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
StringIndex=7
Disabled=1
Group=mCHILDS

;=== MEASURE NFR-SKIN-UPDATE TIME STAMP (mNFRUT) ==
;=== MEASURE NFR-SITE-BUILD  TIME STAMP (mLBTSF) ==

[mNFRUT]
Measure=TIME
Format=%d.%m.%Y [\x00B7] %H:%M:%S
TimeStampLocale=#TSL#
FormatLocale=#FL#
UpdateDivider=-1
Disabled=1
Group=mCHILDS

[mLBTSF]
Measure=TIME
Format=%d.%m.%Y [\x00B7] %H:%M:%S
TimeStamp=[mRSS]
TimeStampFormat=%a, %d %b %Y %H:%M:%S GMT
DynamicVariables=1
Disabled=1

;=== MEASURE MARQUEE FUNCTION =====================

[mXPos]
Measure=LOOP
StartValue=#StartPos#
EndValue=-[NewsFeed:W]
Increment=#Direction#
LoopCount=0
DynamicVariables=1
UpdateDivider=1
Disabled=1

;##################################################
;##################################################
;##################################################
;##################################################
;##################################################
;##################################################

;==================================================
;=== LAYER POS. & LAST NFR-UPD LINE ===============
;==================================================

[LAYERxPosText]
Meter=STRING
MeterStyle=StLAYER
X=0
Y=0

[NFRUpdText]
Meter=STRING
MeterStyle=StNFRUPDATE
X=200
Y=r

;==================================================
;=== HEAD NEWS FEED READER (Side Lines) ===========
;==================================================

[HEADLINES]
Meter=SHAPE
X=0
Y=20
Shape=Rectangle 0,0,8,8 | Extend ModifiersS1
Shape2=Line 8,4,26,4 | Extend ModifiersL1
Shape3=Rectangle 26,0,8,8 | Extend ModifiersS1
;-----
Shape4=Rectangle 0,16,8,8 | Extend ModifiersS2
Shape5=Line 8,20,26,20 | Extend ModifiersL2
Shape6=Rectangle 26,16,8,8 | Extend ModifiersS2
;-----
Shape7=Rectangle ([HEADNAME:W] + 48),0,8,8 | Extend ModifiersS1
Shape8=Rectangle ([HEADNAME:W] + 48),0,8,8 | Extend ModifiersS1
Shape9=Rectangle ([HEADNAME:W] + 48),16,8,8 | Extend ModifiersS2
Shape10=Rectangle ([HEADNAME:W] + 48),16,8,8 | Extend ModifiersS2
;-----
Shape11=Rectangle 872,0,8,8 | Extend ModifiersS1
Shape12=Line 854,4,872,4 | Extend ModifiersL1
Shape13=Rectangle 846,0,8,8 | Extend ModifiersS1
;-----
Shape14=Rectangle 872,16,8,8 | Extend ModifiersS2
Shape15=Line 854,20,872,20 | Extend ModifiersL2
Shape16=Rectangle 846,16,8,8 | Extend ModifiersS2
ModifiersS1=StrokeWidth 0 | Fill Color #Color3##Alpha2#
ModifiersL1=StrokeWidth 2 | StrokeColor #Color3##Alpha2#
ModifiersS2=StrokeWidth 0 | Fill Color #Color3##Alpha1#
ModifiersL2=StrokeWidth 2 | StrokeColor #Color3##Alpha1#
DynamicVariables=1
UpdateDivider=-1
Group=FEED

[HEADNAME]
Meter=STRING
MeterStyle=StHEAD
X=41
Y=r
MouseOverAction=[!SetOption HEADNAME FontColor "#Color4##Alpha1#"][!UpdateMeter HEADNAME][!Redraw]
MouseLeaveAction=[!SetOption HEADNAME FontColor "#Color3##Alpha1#"][!UpdateMeter HEADNAME][!Redraw]
LeftMouseUpAction=[#vURL#]

;==================================================
;=== MARQUEE NEWS FEED READER =====================
;==================================================

;=== CONTAINER NEWS FEED ==========================

[CONTAINER_NFR]
Meter=SHAPE
X=0
Y=r
Shape=Line ([HEADNAME:W] + 63),0,839,0 | StrokeWidth 47 | StrokeColor #Color0##Alpha1#
DynamicVariables=1
UpdateDivider=-1
LeftMouseDoubleClickAction=[#vURL#]
Group=FEED

;=== MARQUEE NEWS FEED ============================

[NewsFeed]
Meter=STRING
MeterStyle=StNEWS
X=[mXPos]r
Y=r
2.) newsfeeddata.inc

Code: Select all

[Variables]
;********************************************************************************************************************************************************
;********************************************************************************************************************************************************
;***                                                                                                                                               ******
;*** !!!!!!!!!!!!!!!!!!   DON`T CHANGE ANYTHING IN THIS FILE   !!!!!!!!!!!!!!!!!!!!!!!   Unless you know what you are doing :-) !!!!!!!!!!!!!!!!!! ******
;*** !!!!!!!!!!!!!!!!!!   DON`T CHANGE ANYTHING IN THIS FILE   !!!!!!!!!!!!!!!!!!!!!!!   Unless you know what you are doing :-) !!!!!!!!!!!!!!!!!! ******
;*** !!!!!!!!!!!!!!!!!!   DON`T CHANGE ANYTHING IN THIS FILE   !!!!!!!!!!!!!!!!!!!!!!!   Unless you know what you are doing :-) !!!!!!!!!!!!!!!!!! ******
;*** !!!!!!!!!!!!!!!!!!   DON`T CHANGE ANYTHING IN THIS FILE   !!!!!!!!!!!!!!!!!!!!!!!   Unless you know what you are doing :-) !!!!!!!!!!!!!!!!!! ******
;***                                                                                                                                               ******
;********************************************************************************************************************************************************
;********************************************************************************************************************************************************
;==================================================
;=== VARIABLES FONTFACE - SIZE - COLORS ===========
;==================================================
FontFace=SQUARE721 BT
FS1=10
FS2=8
Alpha0=1
Alpha1=255
Alpha2=70
Color0=0,0,0,
Color1=160,246,253,
Color2=48,180,200,
Color3=97,240,255,
Color4=253,193,0,
Color5=255,255,255
Color6=255,104,67,
;==================================================
;=== VARIABLES SPEECH PLUGIN (NewsFeed) ===========
;==================================================
VoiceName=Microsoft Hedda Desktop
;IndexName= 
;VoiceGender=
DebugModus=0
VoiceVolume=100
SpeedRate=-2
NewsUpdSpeech=News Feed aktualisiert
;==================================================
;=== VARIABLES NEWS FEED READER ===================
;==================================================
Direction=-1
StartPos=850
RSSUrl=https://news.google.com/rss?pz=1&cf=all&hl=de&gl=DE&ceid=DE:de
vURL=http://news.google.de/
NF1=.*<item.*<title.*>(.*)</title>.*
NF2=.*<title.*>(.*)</title>
NF3=.*<title.*>(.*)</title>
NF4=.*<title.*>(.*)</title>
NF5=.*<title.*>(.*)</title>
TSL=de-DE
FL=de-DE
;==================================================
;=== STYLE NEWS FEED HEAD (Side Line) =============
;==================================================

[StLAYER]
Padding=0,-3,-1,-3
SolidColor=#Color0##Alpha0#
FontColor=#Color1##Alpha1#
FontFace=#FontFace#
FontSize=#FS2#
StringCase=UPPER
AntiAlias=1
Text=LAYER NFR   POS: [NewsFeed:Y] [\x00B7] [mXPos]
InlineSetting=Color | #Color6##Alpha1#
InlinePattern=[NewsFeed:Y]
InlineSetting2=Color | #Color4##Alpha1#
InlinePattern2=[\x00B7](.*)
DynamicVariables=1
UpdateDivider=1
Group=FEED

[StNFRUPDATE]
Padding=0,-3,-1,-3
SolidColor=#Color0##Alpha0#
FontColor=#Color1##Alpha1#
FontFace=#FontFace#
FontSize=#FS2#
StringCase=UPPER
AntiAlias=1
Text=LAST NFR-UPD: [mNFRUT] [\x2022] LAST NFP-BUILD: [mLBTSF]
InlineSetting=Color | #Color6##Alpha1#
InlinePattern=[mNFRUT] | [mLBTSF]
DynamicVariables=1
UpdateDivider=-1
Group=FEED

[StHEAD]
Padding=0,4,-1,5
SolidColor=#Color0##Alpha0#
FontColor=#Color3##Alpha1#
FontFace=#FontFace#
FontSize=#FS1#
StringCase=UPPER
AntiAlias=1
Text=[mRSSNPN]
ClipString=2
ClipStringW=105
ClipStringH=15
DynamicVariables=1
UpdateDivider=-1
Hidden=1

;==================================================
;=== STLYE NEWS FEED ==============================
;==================================================

[StNEWS]
Padding=0,4,-1,5
SolidColor=#Color0##Alpha0#
FontColor=#Color5##Alpha1#
FontFace=#FontFace#
FontSize=#FS1#
StringCase=UPPER
AntiAlias=1
Text=[\x2022][\x2022][\x2022]  [mRSSItem1]  [\x2022][\x2022][\x2022]  [mRSSItem2]  [\x2022][\x2022][\x2022]  [mRSSItem3]  [\x2022][\x2022][\x2022]  [mRSSItem4]  [\x2022][\x2022][\x2022]  [mRSSItem5]  [\x2022][\x2022][\x2022] 
InlineSetting=Color | #Color1##Alpha1#
InlinePattern=(?i)[mRSSItem1] | (?i)[mRSSItem3] | (?i)[mRSSItem5]
InlineSetting2=Color | #Color2##Alpha1#
InlinePattern2=(?i)[mRSSItem2] | (?i)[mRSSItem4]
DynamicVariables=1
UpdateDivider=1
Hidden=1
Container=CONTAINER_NFR
Group=FEED
Unfortunately I can't get this code to work. The WebParser measures don't return anything, but get a RegExp matching error (-1) message in the log. Please check the code, something is not alright with it.
User avatar
Youkai1977
Posts: 164
Joined: October 31st, 2018, 4:11 pm
Location: Germany

Re: Help with parsing html

Post by Youkai1977 »

Oh sorry. :oops:
Yes I had forgotten that I had renamed a measure, but NOT in the OnChangeAction Command-line on the [mRSS]-Measure.
The error is now corrected and nothing shows up in the LOG.

But the time manipulation error is still there. :confused: :???:

Here is the corrected code. It affected ONLY the "newsfeed.ini".
The "newsfeeddata.inc" is not affected by my renamed measure.

1.) newsfeed.ini (Corrected Version)

Code: Select all

[Rainmeter]
Update=20
DefaultUpdateDivider=50
AccurateText=1
DynamicWindowSize=1

[Metadata]
Name=NewsFeed Reader (Marquee)
Author=Youkai1977 
Version=03-21.V1 <> 30.03.2021
Information=This Meter is a Part of M.A.R.S.- 2021 Skin Package
License=Creative Commons Attribution-Non-Commercial-Share Alike 4.0

;==================================================
;=== VARIABLES & STYLES ===========================
;==================================================

[Variables]
@include=newsfeeddata.inc

;==============================================================
;=== VOICE OUTPUT =============================================
;==============================================================
;===                                                         ==
;=== FOR MORE INFO TO SPEECH-PLUGIN                          ==
;=== https://forum.rainmeter.net/viewtopic.php?f=127&t=31161 ==
;===                                                         ==
;==============================================================

[VoiceOutput]
Measure=PLUGIN
Plugin=Speech
Name=#VoiceName#
;Index=#IndexName# 
;Gender=#VoiceGender#
Debug=#DebugModus#
Volume=#VoiceVolume#
Rate=#SpeechRate#
UpdateDivider=-1

;==================================================
;=== MEASURES NEWS FEED & MARQUEE =================
;==================================================

;=== MEASURES NEWS FEED ===========================

[mRSS]
Measure=WEBPARSER
URL=#RSSUrl#
RegExp=(?siU)<lastBuildDate>(.*)</lastBuildDate>.*<description>(.*)</description>#NF1#(?(?=.*<item)#NF2##NF3##NF4##NF5#)
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
DecodeCharacterReference=3
UpdateRate=1200
StringIndex=1
Debug=1
OnChangeAction=[!EnableMeasureGroup mCHILDS][!UpdateMeasure mNFRUT][!SetOption HEADNAME FontColor "#Color4##Alpha1#"][!UpdateMeter HEADNAME][!ShowMeter HEADNAME][!UpdateMeterGroup FEED][!Redraw]
FinishAction=[!EnableMeasure mLBTSF][!UpdateMeasure mLBTSF][!UpdateMeterGroup FEED][!Redraw][!CommandMeasure VoiceOutput "#NewsUpdSpeech#"][!ShowMeter NewsFeed][!EnableMeasure mXPos][!UpdateMeasure mXPos][!Delay 4000][!SetOption HEADNAME FontColor "#Color3##Alpha1#"][!UpdateMeter HEADNAME][!Redraw]

[mRSSNPN]
Measure=WEBPARSER
URL=[mRSS]
StringIndex=2
Disabled=1
Group=mCHILDS

[mRSSItem1]
Measure=WEBPARSER
URL=[mRSS]
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
StringIndex=3
Disabled=1
Group=mCHILDS

[mRSSItem2]
Measure=WEBPARSER
URL=[mRSS]
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
StringIndex=4
Disabled=1
Group=mCHILDS

[mRSSItem3]
Measure=WEBPARSER
URL=[mRSS]
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
StringIndex=5
Disabled=1
Group=mCHILDS

[mRSSItem4]
Measure=WEBPARSER
URL=[mRSS]
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
StringIndex=6
Disabled=1
Group=mCHILDS

[mRSSItem5]
Measure=WEBPARSER
URL=[mRSS]
Substitute="&apos;":"'","&quot;":"","&Quot;":"","&amp;":"&","&lt;br&gt;":"","![CDATA[":"","]]":"","...":"","<":"",">":"","/PRE&gt;":"","PRE&gt;":"","&lt;":"","&#39;":"'","&#228;":"ä","&#246;":"ö","&#8211;":"–"
StringIndex=7
Disabled=1
Group=mCHILDS

;=== MEASURE NFR-SKIN-UPDATE TIME STAMP (mNFRUT) ==
;=== MEASURE NFR-SITE-BUILD  TIME STAMP (mLBTSF) ==

[mNFRUT]
Measure=TIME
Format=%d.%m.%Y [\x00B7] %H:%M:%S
TimeStampLocale=#TSL#
FormatLocale=#FL#
UpdateDivider=-1
Disabled=1
Group=mCHILDS

[mLBTSF]
Measure=TIME
Format=%d.%m.%Y [\x00B7] %H:%M:%S
TimeStamp=[mRSS]
TimeStampFormat=%a, %d %b %Y %H:%M:%S GMT
DynamicVariables=1
Disabled=1

;=== MEASURE MARQUEE FUNCTION =====================

[mXPos]
Measure=LOOP
StartValue=#StartPos#
EndValue=-[NewsFeed:W]
Increment=#Direction#
LoopCount=0
DynamicVariables=1
UpdateDivider=1
Disabled=1

;##################################################
;##################################################
;##################################################
;##################################################
;##################################################
;##################################################

;==================================================
;=== LAYER POS. & LAST NFR-UPD LINE ===============
;==================================================

[LAYERxPosText]
Meter=STRING
MeterStyle=StLAYER
X=0
Y=0

[NFRUpdText]
Meter=STRING
MeterStyle=StNFRUPDATE
X=200
Y=r

;==================================================
;=== HEAD NEWS FEED READER (Side Lines) ===========
;==================================================

[HEADLINES]
Meter=SHAPE
X=0
Y=20
Shape=Rectangle 0,0,8,8 | Extend ModifiersS1
Shape2=Line 8,4,26,4 | Extend ModifiersL1
Shape3=Rectangle 26,0,8,8 | Extend ModifiersS1
;-----
Shape4=Rectangle 0,16,8,8 | Extend ModifiersS2
Shape5=Line 8,20,26,20 | Extend ModifiersL2
Shape6=Rectangle 26,16,8,8 | Extend ModifiersS2
;-----
Shape7=Rectangle ([HEADNAME:W] + 48),0,8,8 | Extend ModifiersS1
Shape8=Rectangle ([HEADNAME:W] + 48),0,8,8 | Extend ModifiersS1
Shape9=Rectangle ([HEADNAME:W] + 48),16,8,8 | Extend ModifiersS2
Shape10=Rectangle ([HEADNAME:W] + 48),16,8,8 | Extend ModifiersS2
;-----
Shape11=Rectangle 872,0,8,8 | Extend ModifiersS1
Shape12=Line 854,4,872,4 | Extend ModifiersL1
Shape13=Rectangle 846,0,8,8 | Extend ModifiersS1
;-----
Shape14=Rectangle 872,16,8,8 | Extend ModifiersS2
Shape15=Line 854,20,872,20 | Extend ModifiersL2
Shape16=Rectangle 846,16,8,8 | Extend ModifiersS2
ModifiersS1=StrokeWidth 0 | Fill Color #Color3##Alpha2#
ModifiersL1=StrokeWidth 2 | StrokeColor #Color3##Alpha2#
ModifiersS2=StrokeWidth 0 | Fill Color #Color3##Alpha1#
ModifiersL2=StrokeWidth 2 | StrokeColor #Color3##Alpha1#
DynamicVariables=1
UpdateDivider=-1
Group=FEED

[HEADNAME]
Meter=STRING
MeterStyle=StHEAD
X=41
Y=r
MouseOverAction=[!SetOption HEADNAME FontColor "#Color4##Alpha1#"][!UpdateMeter HEADNAME][!Redraw]
MouseLeaveAction=[!SetOption HEADNAME FontColor "#Color3##Alpha1#"][!UpdateMeter HEADNAME][!Redraw]
LeftMouseUpAction=[#vURL#]

;==================================================
;=== MARQUEE NEWS FEED READER =====================
;==================================================

;=== CONTAINER NEWS FEED ==========================

[CONTAINER_NFR]
Meter=SHAPE
X=0
Y=r
Shape=Line ([HEADNAME:W] + 63),0,839,0 | StrokeWidth 47 | StrokeColor #Color0##Alpha1#
DynamicVariables=1
UpdateDivider=-1
LeftMouseDoubleClickAction=[#vURL#]
Group=FEED

;=== MARQUEE NEWS FEED ============================

[NewsFeed]
Meter=STRING
MeterStyle=StNEWS
X=[mXPos]r
Y=r
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with parsing html

Post by balala »

Youkai1977 wrote: April 3rd, 2021, 10:38 am Oh sorry. :oops:
Yes I had forgotten that I had renamed a measure, but NOT in the OnChangeAction Command-line on the [mRSS]-Measure.
The error is now corrected and nothing shows up in the LOG.
But nor in the skin, which still doesn't work, not even with the new code. Please check once again.
Post Reply