It is currently April 24th, 2024, 11:07 am
Help with parsing html
-
- Posts: 12
- Joined: December 22nd, 2020, 10:39 pm
Re: Help with parsing html
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!
-
- Rainmeter Sage
- Posts: 2604
- Joined: March 23rd, 2015, 5:26 pm
Re: Help with parsing html
I'm not all that savvy at regexps, but try the following in your main [MeasureSite] measure: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!
Code: Select all
RegExp=(?siU){.*{.*:"(.*)".*:{".*":(.*),.*:(.*),.*:(.*)},.*:"(.*)"}}
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.
-
- Posts: 164
- Joined: October 31st, 2018, 4:11 pm
- Location: Germany
Re: Help with parsing html
I hope I may hang myself with my problem here simply times ...
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.
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.
Am I right with my suspicion, or do I have it (according to the motto, a blind hen also finds a grain) actually right?
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.
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.
Am I right with my suspicion, or do I have it (according to the motto, a blind hen also finds a grain) actually right?
You do not have the required permissions to view the files attached to this post.
- Win11 Pro x64 (23H2 - 22631.3085)
- Rainmeter 4.5.18
- Gigabyte B550i AORUS Pro AX V1.2
- Corsair Venegeance LPX 2x 16GB (32GB) DDR4 3200MHz
- RYZEN 7 5800X
- PowerColor RX570 8GB
- Samsung 980Pro 250GB (NVMe) - Drive C: Windows
- Kingston SNV2S1000G (NVMe) - Drive D: Rainmeter, Skins & Others - Drive D: Games
- NAS Synology DS216j - 2x 1GB HDDs - My Main Backup & Data Storage in my Home-Network
- Mon 1: 24" HP 24f (1920 x 1080 @ 75Hz) - Primary
- Mon 2: 22" Philips 226VL (1920 x 1080 @ 60Hz) - Secondary 1
- Mon 3: 50" Philips 50PUS7304/12 (3840 x 2160 @ 60Hz) - Secondary 2
- Corsair CX 650M Power Supply
- NZXT H210 Case
- ISP Vodafone with 1000/50 Mbit Cable Internet
The absolutly High-End Machine on 2024 ... at least the graphics card
- Rainmeter 4.5.18
- Gigabyte B550i AORUS Pro AX V1.2
- Corsair Venegeance LPX 2x 16GB (32GB) DDR4 3200MHz
- RYZEN 7 5800X
- PowerColor RX570 8GB
- Samsung 980Pro 250GB (NVMe) - Drive C: Windows
- Kingston SNV2S1000G (NVMe) - Drive D: Rainmeter, Skins & Others - Drive D: Games
- NAS Synology DS216j - 2x 1GB HDDs - My Main Backup & Data Storage in my Home-Network
- Mon 1: 24" HP 24f (1920 x 1080 @ 75Hz) - Primary
- Mon 2: 22" Philips 226VL (1920 x 1080 @ 60Hz) - Secondary 1
- Mon 3: 50" Philips 50PUS7304/12 (3840 x 2160 @ 60Hz) - Secondary 2
- Corsair CX 650M Power Supply
- NZXT H210 Case
- ISP Vodafone with 1000/50 Mbit Cable Internet
The absolutly High-End Machine on 2024 ... at least the graphics card
-
- Rainmeter Sage
- Posts: 16164
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Help with parsing html
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.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
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
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
Obviously you can freely modify the Format option of the measure, to get the appropriate format.
-
- Posts: 164
- Joined: October 31st, 2018, 4:11 pm
- Location: Germany
Re: Help with parsing html
Hi, Thanks for your tip / idea.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: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
[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
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.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
Obviously you can freely modify the Format option of the measure, to get the appropriate format.
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: 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?
You do not have the required permissions to view the files attached to this post.
- Win11 Pro x64 (23H2 - 22631.3085)
- Rainmeter 4.5.18
- Gigabyte B550i AORUS Pro AX V1.2
- Corsair Venegeance LPX 2x 16GB (32GB) DDR4 3200MHz
- RYZEN 7 5800X
- PowerColor RX570 8GB
- Samsung 980Pro 250GB (NVMe) - Drive C: Windows
- Kingston SNV2S1000G (NVMe) - Drive D: Rainmeter, Skins & Others - Drive D: Games
- NAS Synology DS216j - 2x 1GB HDDs - My Main Backup & Data Storage in my Home-Network
- Mon 1: 24" HP 24f (1920 x 1080 @ 75Hz) - Primary
- Mon 2: 22" Philips 226VL (1920 x 1080 @ 60Hz) - Secondary 1
- Mon 3: 50" Philips 50PUS7304/12 (3840 x 2160 @ 60Hz) - Secondary 2
- Corsair CX 650M Power Supply
- NZXT H210 Case
- ISP Vodafone with 1000/50 Mbit Cable Internet
The absolutly High-End Machine on 2024 ... at least the graphics card
- Rainmeter 4.5.18
- Gigabyte B550i AORUS Pro AX V1.2
- Corsair Venegeance LPX 2x 16GB (32GB) DDR4 3200MHz
- RYZEN 7 5800X
- PowerColor RX570 8GB
- Samsung 980Pro 250GB (NVMe) - Drive C: Windows
- Kingston SNV2S1000G (NVMe) - Drive D: Rainmeter, Skins & Others - Drive D: Games
- NAS Synology DS216j - 2x 1GB HDDs - My Main Backup & Data Storage in my Home-Network
- Mon 1: 24" HP 24f (1920 x 1080 @ 75Hz) - Primary
- Mon 2: 22" Philips 226VL (1920 x 1080 @ 60Hz) - Secondary 1
- Mon 3: 50" Philips 50PUS7304/12 (3840 x 2160 @ 60Hz) - Secondary 2
- Corsair CX 650M Power Supply
- NZXT H210 Case
- ISP Vodafone with 1000/50 Mbit Cable Internet
The absolutly High-End Machine on 2024 ... at least the graphics card
-
- Rainmeter Sage
- Posts: 16164
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Help with parsing html
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.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.
-
- Posts: 164
- Joined: October 31st, 2018, 4:11 pm
- Location: Germany
Re: Help with parsing html
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.
But well, here is the code...
1.) newsfeed.ini
- Win11 Pro x64 (23H2 - 22631.3085)
- Rainmeter 4.5.18
- Gigabyte B550i AORUS Pro AX V1.2
- Corsair Venegeance LPX 2x 16GB (32GB) DDR4 3200MHz
- RYZEN 7 5800X
- PowerColor RX570 8GB
- Samsung 980Pro 250GB (NVMe) - Drive C: Windows
- Kingston SNV2S1000G (NVMe) - Drive D: Rainmeter, Skins & Others - Drive D: Games
- NAS Synology DS216j - 2x 1GB HDDs - My Main Backup & Data Storage in my Home-Network
- Mon 1: 24" HP 24f (1920 x 1080 @ 75Hz) - Primary
- Mon 2: 22" Philips 226VL (1920 x 1080 @ 60Hz) - Secondary 1
- Mon 3: 50" Philips 50PUS7304/12 (3840 x 2160 @ 60Hz) - Secondary 2
- Corsair CX 650M Power Supply
- NZXT H210 Case
- ISP Vodafone with 1000/50 Mbit Cable Internet
The absolutly High-End Machine on 2024 ... at least the graphics card
- Rainmeter 4.5.18
- Gigabyte B550i AORUS Pro AX V1.2
- Corsair Venegeance LPX 2x 16GB (32GB) DDR4 3200MHz
- RYZEN 7 5800X
- PowerColor RX570 8GB
- Samsung 980Pro 250GB (NVMe) - Drive C: Windows
- Kingston SNV2S1000G (NVMe) - Drive D: Rainmeter, Skins & Others - Drive D: Games
- NAS Synology DS216j - 2x 1GB HDDs - My Main Backup & Data Storage in my Home-Network
- Mon 1: 24" HP 24f (1920 x 1080 @ 75Hz) - Primary
- Mon 2: 22" Philips 226VL (1920 x 1080 @ 60Hz) - Secondary 1
- Mon 3: 50" Philips 50PUS7304/12 (3840 x 2160 @ 60Hz) - Secondary 2
- Corsair CX 650M Power Supply
- NZXT H210 Case
- ISP Vodafone with 1000/50 Mbit Cable Internet
The absolutly High-End Machine on 2024 ... at least the graphics card
-
- Rainmeter Sage
- Posts: 16164
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Help with parsing html
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.Youkai1977 wrote: ↑April 2nd, 2021, 5:48 am But well, here is the code...
1.) newsfeed.ini2.) newsfeeddata.inc
-
- Posts: 164
- Joined: October 31st, 2018, 4:11 pm
- Location: Germany
Re: Help with parsing html
Oh sorry.
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.
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)
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.
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)
- Win11 Pro x64 (23H2 - 22631.3085)
- Rainmeter 4.5.18
- Gigabyte B550i AORUS Pro AX V1.2
- Corsair Venegeance LPX 2x 16GB (32GB) DDR4 3200MHz
- RYZEN 7 5800X
- PowerColor RX570 8GB
- Samsung 980Pro 250GB (NVMe) - Drive C: Windows
- Kingston SNV2S1000G (NVMe) - Drive D: Rainmeter, Skins & Others - Drive D: Games
- NAS Synology DS216j - 2x 1GB HDDs - My Main Backup & Data Storage in my Home-Network
- Mon 1: 24" HP 24f (1920 x 1080 @ 75Hz) - Primary
- Mon 2: 22" Philips 226VL (1920 x 1080 @ 60Hz) - Secondary 1
- Mon 3: 50" Philips 50PUS7304/12 (3840 x 2160 @ 60Hz) - Secondary 2
- Corsair CX 650M Power Supply
- NZXT H210 Case
- ISP Vodafone with 1000/50 Mbit Cable Internet
The absolutly High-End Machine on 2024 ... at least the graphics card
- Rainmeter 4.5.18
- Gigabyte B550i AORUS Pro AX V1.2
- Corsair Venegeance LPX 2x 16GB (32GB) DDR4 3200MHz
- RYZEN 7 5800X
- PowerColor RX570 8GB
- Samsung 980Pro 250GB (NVMe) - Drive C: Windows
- Kingston SNV2S1000G (NVMe) - Drive D: Rainmeter, Skins & Others - Drive D: Games
- NAS Synology DS216j - 2x 1GB HDDs - My Main Backup & Data Storage in my Home-Network
- Mon 1: 24" HP 24f (1920 x 1080 @ 75Hz) - Primary
- Mon 2: 22" Philips 226VL (1920 x 1080 @ 60Hz) - Secondary 1
- Mon 3: 50" Philips 50PUS7304/12 (3840 x 2160 @ 60Hz) - Secondary 2
- Corsair CX 650M Power Supply
- NZXT H210 Case
- ISP Vodafone with 1000/50 Mbit Cable Internet
The absolutly High-End Machine on 2024 ... at least the graphics card
-
- Rainmeter Sage
- Posts: 16164
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Help with parsing html
But nor in the skin, which still doesn't work, not even with the new code. Please check once again.Youkai1977 wrote: ↑April 3rd, 2021, 10:38 am Oh sorry.
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.