It is currently May 27th, 2020, 3:33 am

COVID-19 Statbar

Post your work-in-progress and completed skins to share and discuss.
User avatar
balala
Rainmeter Sage
Posts: 10605
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: COVID-19 Statbar

Post by balala »

mak_kawa wrote:
April 20th, 2020, 2:31 am
So, need to modify RegExp...
Unfortunately I assume you'll have to do this quite frequently. This is a great disadvantage if you're parsing a site.
ms310
Posts: 195
Joined: April 1st, 2015, 7:16 am

Re: COVID-19 Statbar

Post by ms310 »

mak_kawa wrote:
April 20th, 2020, 2:31 am
As ms310 said, nCov2019.live is now back and with changed HTML structure. So, need to modify RegExp...
I don't have time to fully put this into the skin at the moment but I did play around with RainRegExp and came up with the following:

Code: Select all

RegExp=(?siU)<span class="legend-label confirmed">(.*)</span>.*<span class="legend-label critical">(.*)</span>.*<span class="legend-label deceased">(.*)</span>.*<span class="legend-label recovered">(.*)</span>.*
Here are the StringIndex values:
1: Total Cases
2: Total Critical
3: Total Deceased
4: Total Recovered

I didn't bother with "updated" - this site is constantly updated and you will notice that value always says "a few seconds ago".

I hope this helps.
mak_kawa
Posts: 644
Joined: December 30th, 2015, 9:47 am

Re: COVID-19 Statbar

Post by mak_kawa »

Hi balala

Yes, they (=web site designers) never care about Rainmeter Webparser parsing. And do what they want...:-)
User avatar
balala
Rainmeter Sage
Posts: 10605
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: COVID-19 Statbar

Post by balala »

mak_kawa wrote:
April 20th, 2020, 9:11 am
Yes, they (=web site designers) never care about Rainmeter Webparser parsing. And do what they want...:-)
I think at least in some cases they are changing the source code of the sites exactly to avoid such tools like Rainmeter to parse their sites. I'm not sure, but have this feeling.
dvo
Posts: 787
Joined: February 7th, 2016, 6:08 am

Re: COVID-19 Statbar

Post by dvo »

most of the sites are rebuilding to add more info and countries or rebuilding the info to show in a diffrent way... ;-)
mak_kawa
Posts: 644
Joined: December 30th, 2015, 9:47 am

Re: COVID-19 Statbar

Post by mak_kawa »

HTML structure of the nCoV2019.live seems to be changed this morning. I must modify my RegExp again (and again?)...:-)
Now think seriously I have to be back to the worldometer...
User avatar
balala
Rainmeter Sage
Posts: 10605
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: COVID-19 Statbar

Post by balala »

mak_kawa wrote:
April 23rd, 2020, 12:06 pm
HTML structure of the nCoV2019.live seems to be changed this morning. I must modify my RegExp again (and again?)...:-)
Yes, again and again: https://forum.rainmeter.net/viewtopic.php?p=175051#p174828
mak_kawa
Posts: 644
Joined: December 30th, 2015, 9:47 am

Re: COVID-19 Statbar

Post by mak_kawa »

Hi balala

Owner/developer(?) of the nCov2019.live site is a motivated highschool boy, and he always modifying the HTML to improve his COVID-19 site. Very good.

But it bothers me that my RegExp description is frequently broken. It's a dark side of the web-scraping. Maybe there would be a smart RegExp method (lookahead assertion??) to adapt to such changing HTML, but I don't know. And if such a method exists, I can't use/handle it with my skill...

I must live with it as a Rainmeter noob. :-)
User avatar
balala
Rainmeter Sage
Posts: 10605
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: COVID-19 Statbar

Post by balala »

mak_kawa wrote:
April 23rd, 2020, 8:28 pm
Maybe there would be a smart RegExp method (lookahead assertion??) to adapt to such changing HTML, but I don't know. And if such a method exists, I can't use/handle it with my skill...
Don't know, didn't take a look yet, but I doubt there is. Lookahead Assertion is used when on the site should be some occurrences of a string, but you don't know how many or if they even are there. But when the HTML code changes, usually Lookahead Assertion doesn't help.
Right now I'm not working anymore for today, but maybe tomorrow will try to figure out something. But I don't promis anything. Sorry...
mak_kawa
Posts: 644
Joined: December 30th, 2015, 9:47 am

Re: COVID-19 Statbar

Post by mak_kawa »

Hi balala

Thank you for clarification about the lookahead assertion.

Perhaps, I can make solution using RegExpSubstitution which follows such "changing HTML". I am not confident, but will try.