It is currently September 14th, 2024, 5:24 pm
⭐ Weather.com - Parsing the V3 JSON
-
- Developer
- Posts: 22743
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
You are right! I'll change that the next time I modify the @Include files. Thanks!
-
- Rainmeter Sage
- Posts: 8126
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
You'll find a lot of such things in any skin that uses regex though, not just here. While you're absolutely right that it takes more steps (I'm also careful in that regard, never using something if it's not functionally required), my feeling is that the (?siU) flags are used just as a way to "set and forget" in most skins, where this form is preferred "just in case", even though some of the individual flags are not always needed.nek wrote: ↑January 30th, 2021, 7:29 pm I found something, tiny things about regular expressions in the
WeatherComJSON_August 4, 2020.rmskin > WeatherComJSONMeasures.inc | Updated July 31, 2020
There is a code RegExp=(?siU)^(.*)$ for WebParser measure, but RegExp=(?s)^(.*)$ is fewer steps and faster to parse.
Just curious, why didn't you suggested ^([\s\S]*)$ instead? In your table it's the most efficient, and this is supported by various analyses by regex experts online, who point out that specifying the pattern as close as possible yields the best results in terms of speed. Some even suggest avoiding the . (dot, every character) pattern as often and whenever possible, and "narrow down" the pattern to make it faster.
-
- Posts: 111
- Joined: November 3rd, 2019, 12:00 am
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
Because...Yincognito wrote: ↑January 30th, 2021, 9:03 pm Just curious, why didn't you suggested ^([\s\S]*)$ instead?
I am not expert of the regular expressions, and I don't remember whitch \s \S is match with whitespace character.
I just feel that (?s)^.*$ is more easier to understand for people. That's it.
Last edited by nek on March 23rd, 2021, 6:45 pm, edited 1 time in total.
-
- Rainmeter Sage
- Posts: 8126
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
Ah, ok, no problem - I'm not an expert either. I guess I was just confused as to why a technical reason was appropriate for a certain choice, while it wasn't for the other, that's all.
P.S. Remembering what \s and \S stand for is easy: in regex, lower-case are affirmations, while upper-case are negations (e.g. \d = digit, \D = not digit; \s = whitespace. \S = not whitespace; \w = word, \W= not word; etc).
-
- Posts: 13
- Joined: August 7th, 2021, 1:53 pm
- Location: Ukraine
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
Any idea how to change unit of Pressure value form mb to mm Hg?
-
- Rainmeter Sage
- Posts: 8126
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
Only mb (millibar) and in (inch) are available as units for atmospheric pressure on weather.com, as far as I know, but you can use a Calc measure to convert the already existing pressure measure value to mmHg:
Code: Select all
[PressuremmHg]
Measure=Calc
Formula=(Pressuremb*750.062)
DynamicVariables=1
-
- Posts: 1666
- Joined: February 17th, 2011, 7:45 pm
- Location: a Galaxy S7 far far away
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
I just wondered if it would be ok to edit this, to suit my Rounded suite, for sharing?
If not I'd still like to add it to that suite, but will not share it. All credits will remain.
Thanks
If not I'd still like to add it to that suite, but will not share it. All credits will remain.
Thanks
57686174 77696C6C 6265 77696C6C 6265
-
- Developer
- Posts: 22743
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
Use this code any way at all that you want to!
-
- Posts: 1666
- Joined: February 17th, 2011, 7:45 pm
- Location: a Galaxy S7 far far away
-
- Posts: 2
- Joined: November 28th, 2021, 2:40 pm
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
First of all sorry for my English, I am using a translator.
My question is because the orange symbol does not appear on the skin, if the weather.com page itself indicates it:
Taking a look at the API file I see that it indicates 4 in one section and 2 in another:
"eventDescription":"Alteración potencial debido a acontecimiento costero","severityCode":4,"severity":"Minor","categories":[{"category":"Met","categoryCode":2}],"responseTypes":[{"responseType":"Avoid","responseTypeCode":5}]
Are the alerts settings on the skin correct or is it a Weather.com bug?
Greetings, thanks and sorry for the inconvenience.
My question is because the orange symbol does not appear on the skin, if the weather.com page itself indicates it:
Taking a look at the API file I see that it indicates 4 in one section and 2 in another:
"eventDescription":"Alteración potencial debido a acontecimiento costero","severityCode":4,"severity":"Minor","categories":[{"category":"Met","categoryCode":2}],"responseTypes":[{"responseType":"Avoid","responseTypeCode":5}]
Are the alerts settings on the skin correct or is it a Weather.com bug?
Greetings, thanks and sorry for the inconvenience.