It is currently April 19th, 2024, 1:48 pm

Little help

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Little help

Post by Yincognito »

JamX wrote: July 24th, 2020, 8:21 pm it seems the regexp error has nothing to do with the "white" values
Capture3.JPG

Now, at 20:03, I had an error and the values are till now OK, but I made some changes...

I've taken a look at the original code from the Author Mordasius where het states:


So I added my useragent: MyUserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36 Edg/84.0.522.40

and added it into the code like:

Code: Select all

[InfoIndex1]
Measure=WebParser
URL=https://www.cnbc.com/quotes/#Symbol1#
UserAgent=#MyUserAgent#
RegExp=#ExpQuote#
StringIndex=1
UpdateRate=#UpdateQuotes#
FinishAction=[!Log "Quote Update Finished"]
I also changes #UpdateQuotes# to 60 in stead of 15

Question:
What does the useragent actually do?
Before I had NO agent and sometimes the values turned white but most of the time (>95%) values were displayed OK
Now I have an agent and til now (knok on wood) the values are displayed OK
In this case, the user agent string is trying to trick the site into believing that it has been opened up from a browser.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
JamX
Posts: 207
Joined: October 4th, 2019, 2:46 pm

Re: Little help

Post by JamX »

So, I. General you could say that I do not need a user agent because I alway get the values from the site dispite sometimes assigning the wrong color to it (White)

Maybe increasing the Update rate solved the issue. Till last evening no White values shown
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Little help

Post by Yincognito »

JamX wrote: July 25th, 2020, 9:34 am So, I. General you could say that I do not need a user agent because I alway get the values from the site dispite sometimes assigning the wrong color to it (White)
Yes, indeed. If the user agent was the problem, you wouldn't have been able to extract the data from the site in the first place.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
madsen
Posts: 2
Joined: January 19th, 2021, 1:04 am

Re: Little help

Post by madsen »

Hi!

Few days ago it seems CNCB changed their website and i now get a RegExp matching error(-1).

Can anyone help with matching the new regexp? ;-)
User avatar
JamX
Posts: 207
Joined: October 4th, 2019, 2:46 pm

Re: Little help

Post by JamX »

change the ExpQuote variable with following code

Code: Select all

;ExpQuote=(?siU).*div id="structured-data".*"name" content="(.*)" />.*"price" content="(\d+\.\d{0,2}+).*"PriceChange" content="(.*)" .*"PriceChangePercent" content="(.*)"
ExpQuote=(?siU).*"name":"(.*)".*"price":"(\d+\.\d{0,2}+).*"PriceChange":"(.*)".*"PriceChangePercent":"(.*)"
jestith
Posts: 3
Joined: January 19th, 2021, 4:44 pm

Re: Little help

Post by jestith »

Thanks, JamX, for the ExpQuote code update!

For me, it works fine with the exception of stocks with share prices over $1K (e.g. AMNZ and GOOG) but maybe that's a result of other things going on in my portfolio code. This was a huge help in getting me back on track. Thanks again!
User avatar
JamX
Posts: 207
Joined: October 4th, 2019, 2:46 pm

Re: Little help

Post by JamX »

try this:

Code: Select all

ExpQuote=(?siU).*"name":"(.*)".*"price":"(.*)".*"PriceChange":"(.*)".*"PriceChangePercent":"(.*)"
jestith
Posts: 3
Joined: January 19th, 2021, 4:44 pm

Re: Little help

Post by jestith »

Thanks so much for the fast response!

This gets things closer. I no longer see a zero for price, but now it seems that for share prices over 1K, I'm seeing the first digit. E.g for AMZN, instead of seeing 3124, I'm seeing 3. But I will investigate more to see if this could reflect some other issue in my code.

Thanks again!
User avatar
JamX
Posts: 207
Joined: October 4th, 2019, 2:46 pm

Re: Little help

Post by JamX »

If I use this:

Code: Select all

(?siU).*"name":"(.*)".*"price":"(.*)".*"PriceChange":"(.*)".*"PriceChangePercent":"(.*)"
Capture.JPG
it's working
You do not have the required permissions to view the files attached to this post.
jestith
Posts: 3
Joined: January 19th, 2021, 4:44 pm

Re: Little help

Post by jestith »

Thanks so much, JamX. My second problem must be elsewhere in my code, maybe when I convert mindex1_Price from a String to a number. I will investigate.

I really appreciate the time you took!