It is currently July 2nd, 2024, 5:44 am

⭐ Weather.com - Parsing the V3 JSON

Our most popular Tips and Tricks from the Rainmeter Team and others
User avatar
VClouds
Posts: 78
Joined: April 7th, 2010, 2:34 pm

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by VClouds »

jsmorley wrote: June 7th, 2020, 12:20 pm For instance, right now my local conditions are "Clear" in the JSON, but "Sunny" in the HTML. That is a distinction without much difference I guess, but all I think we can do is go with the JSON.



1.jpg



To me at least, "Clear" feels more like a "nighttime" condition, analogous to "Sunny" in the "daytime". Since it is quite early morning here, the JSON might just be a tad behind the HTML in that sense.

Okay now I understand, I thought the info in both json and html would be identical.
but the conditions that don't match the icons seems a bit off and picks at my OCD. :D
well, hopefully its only for the subtly different conditions like fair and partly cloudy and not for fair and thunderstorms...
User avatar
jsmorley
Developer
Posts: 22643
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by jsmorley »

As to barometric pressure, we are going to want to keep an eye on that. There are three more or less common ways of measuring atmospheric pressure. Inches of Mercury (inHg), Millibars (mb) and Hectopascals (hPa). I seem to recall that "some" language codes used to use hPa as the unit for pressure, but the site now only returns e/m/h as the unit code, so we assumed mb in all cases of "m". It's possible that this could be more complicated. We will see.
User avatar
jsmorley
Developer
Posts: 22643
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by jsmorley »

VClouds wrote: June 7th, 2020, 12:50 pm Okay now I understand, I thought the info in both json and html would be identical.
but the conditions that don't match the icons seems a bit off and picks at my OCD. :D
well, hopefully its only for the subtly different conditions like fair and partly cloudy and not for fair and thunderstorms...
Yeah, I don't think there are, and have not seen, any substantive difference. "Partly Cloudy" and "Mostly Sunny" sorta mean the same thing really.
User avatar
Yincognito
Rainmeter Sage
Posts: 7598
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by Yincognito »

VClouds wrote: June 7th, 2020, 12:50 pm Okay now I understand, I thought the info in both json and html would be identical.
but the conditions that don't match the icons seems a bit off and picks at my OCD. :D
well, hopefully its only for the subtly different conditions like fair and partly cloudy and not for fair and thunderstorms...
jsmorley wrote: June 7th, 2020, 12:55 pm

Yeah, I don't think there are, and have not seen, any substantive difference. "Partly Cloudy" and "Mostly Sunny" sorta mean the same thing really.
Yeah, neither of you understand it, and no one bothers reading what I just wrote earlier, no offense.
Proof - the regex used by OnyxBlack to capture the current conditions:

Code: Select all

RegExp=(?siU)"getSunV3CurrentObservationsUrlConfig":.*"cloudCoverPhrase":(.*),.*"iconCode":(.*),.*"precip24Hour":(.*),.*"pressureAltimeter":(.*),.*"pressureChange":(.*),.*"pressureTendencyCode":(.*),.*"pressureTendencyTrend":(.*),.*"relativeHumidity":(.*),.*"sunriseTimeLocal":(.*),.*"sunsetTimeLocal":(.*),.*"temperature":(.*),.*"temperatureDewPoint":(.*),.*"temperatureFeelsLike":(.*),.*"temperatureMaxSince7AM":(.*),.*"uvDescription":(.*),.*"uvIndex":(.*),.*"validTimeLocal":(.*),.*"visibility":(.*),.*"windDirection":(.*),.*"windDirectionCardinal":(.*),.*"windGust":(.*),.*"windSpeed":(.*),
Notice he captures the cloud cover phrase, and not the wx phrase long, which is wrong. See here.

Current proof - the current conditions for me, taken from the page source:

Code: Select all

{"cloudCeiling":24000,"cloudCoverPhrase":"Cloudy","dayOfWeek":"Sunday","dayOrNight":"D","expirationTimeUtc":1591535279,"iconCode":28,"iconCodeExtend":2800,"obsQualifierCode":null,"obsQualifierSeverity":null,"precip1Hour":0,"precip6Hour":0,"precip24Hour":2.54,"pressureAltimeter":1010.16,"pressureChange":-0.68,"pressureMeanSeaLevel":1009.9,"pressureTendencyCode":2,"pressureTendencyTrend":"Falling","relativeHumidity":39,"snow1Hour":0,"snow6Hour":0,"snow24Hour":0,"sunriseTimeLocal":"2020-06-07T05:15:51+0300","sunriseTimeUtc":1591496151,"sunsetTimeLocal":"2020-06-07T21:10:52+0300","sunsetTimeUtc":1591553452,"temperature":26,"temperatureChange24Hour":0,"temperatureDewPoint":11,"temperatureFeelsLike":27,"temperatureHeatIndex":27,"temperatureMax24Hour":27,"temperatureMaxSince7Am":27,"temperatureMin24Hour":16,"temperatureWindChill":26,"uvDescription":"Moderate","uvIndex":3,"validTimeLocal":"2020-06-07T15:57:59+0300","validTimeUtc":1591534679,"visibility":14.48,"windDirection":140,"windDirectionCardinal":"SE","windGust":37,"windSpeed":24,"wxPhraseLong":"Mostly Cloudy","wxPhraseMedium":"Mostly Cloudy","wxPhraseShort":"M Cloudy"},"status":200,"statusText":"OK"}}
Screenshot of weather.com main page:
Weather.jpg
So, the phrase displayed is the wx phrase, and not the cloud cover one.
You do not have the required permissions to view the files attached to this post.
Last edited by Yincognito on June 7th, 2020, 1:06 pm, edited 2 times in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22643
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by jsmorley »

Yincognito wrote: June 7th, 2020, 12:58 pm Yeah, neither of you understand it, and no one bothers reading what I just wrote earlier, no offense.
Proof - the regex used by OnyxBlack to capture the current conditions:

Code: Select all

RegExp=(?siU)"getSunV3CurrentObservationsUrlConfig":.*"cloudCoverPhrase":(.*),.*"iconCode":(.*),.*"precip24Hour":(.*),.*"pressureAltimeter":(.*),.*"pressureChange":(.*),.*"pressureTendencyCode":(.*),.*"pressureTendencyTrend":(.*),.*"relativeHumidity":(.*),.*"sunriseTimeLocal":(.*),.*"sunsetTimeLocal":(.*),.*"temperature":(.*),.*"temperatureDewPoint":(.*),.*"temperatureFeelsLike":(.*),.*"temperatureMaxSince7AM":(.*),.*"uvDescription":(.*),.*"uvIndex":(.*),.*"validTimeLocal":(.*),.*"visibility":(.*),.*"windDirection":(.*),.*"windDirectionCardinal":(.*),.*"windGust":(.*),.*"windSpeed":(.*),
Notice he captures the cloud cover phrase, and not the wx phrase long, which is wrong. See here.
Oh my, you are absolutely right. cloudCoverPhrase is not something that should be used for current conditions. I will fix that today.
Wim
Posts: 72
Joined: September 22nd, 2010, 8:30 pm

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by Wim »

jsmorley wrote: June 7th, 2020, 12:53 pm As to barometric pressure, we are going to want to keep an eye on that. There are three more or less common ways of measuring atmospheric pressure. Inches of Mercury (inHg), Millibars (mb) and Hectopascals (hPa). I seem to recall that "some" language codes used to use hPa as the unit for pressure, but the site now only returns e/m/h as the unit code, so we assumed mb in all cases of "m". It's possible that this could be more complicated. We will see.
The German language output originally gave hPA. It no longer does; it's now in mb
User avatar
Yincognito
Rainmeter Sage
Posts: 7598
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by Yincognito »

jsmorley wrote: June 7th, 2020, 1:01 pm Oh my, you are absolutely right. cloudCoverPhrase is not something that should be used for current conditions. I will fix that today.
Right. You may take a look at the pressure thing while you're at it, as I have the feeling that it's related to commas. Not sure though on this one, just a supposition.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Pflosch
Posts: 39
Joined: May 24th, 2020, 7:04 am
Location: Switzerland

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by Pflosch »

jsmorley wrote: June 7th, 2020, 12:53 pm As to barometric pressure, we are going to want to keep an eye on that. There are three more or less common ways of measuring atmospheric pressure. Inches of Mercury (inHg), Millibars (mb) and Hectopascals (hPa). I seem to recall that "some" language codes used to use hPa as the unit for pressure, but the site now only returns e/m/h as the unit code, so we assumed mb in all cases of "m". It's possible that this could be more complicated. We will see.
1000 inHg are 33'863mbar
So that's what it's showing me, but I can't make sense outta it.
It should of course be 1000mbar, which is 29.5inHg
A conversion too much somewhere...?
I think maybe no problem.
User avatar
jsmorley
Developer
Posts: 22643
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by jsmorley »

Ok, I have fixed the "Current Conditions" and posted a new .rmskin in the first post of this thread.

This keeps the original (but fixed) @CurrentConditions, and adds three new measures:

@CurrentCloudCoverPhrase
@CurrentConditionsMedium
@CurrentConditionsShort
User avatar
VClouds
Posts: 78
Joined: April 7th, 2010, 2:34 pm

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by VClouds »

Yincognito wrote: June 7th, 2020, 12:58 pm Yeah, neither of you understand it, and no one bothers reading what I just wrote earlier, no offense.
Proof - the regex used by OnyxBlack to capture the current conditions:

Code: Select all

RegExp=(?siU)"getSunV3CurrentObservationsUrlConfig":.*"cloudCoverPhrase":(.*),.*"iconCode":(.*),.*"precip24Hour":(.*),.*"pressureAltimeter":(.*),.*"pressureChange":(.*),.*"pressureTendencyCode":(.*),.*"pressureTendencyTrend":(.*),.*"relativeHumidity":(.*),.*"sunriseTimeLocal":(.*),.*"sunsetTimeLocal":(.*),.*"temperature":(.*),.*"temperatureDewPoint":(.*),.*"temperatureFeelsLike":(.*),.*"temperatureMaxSince7AM":(.*),.*"uvDescription":(.*),.*"uvIndex":(.*),.*"validTimeLocal":(.*),.*"visibility":(.*),.*"windDirection":(.*),.*"windDirectionCardinal":(.*),.*"windGust":(.*),.*"windSpeed":(.*),
Notice he captures the cloud cover phrase, and not the wx phrase long, which is wrong. See here.

Current proof - the current conditions for me, taken from the page source:

Code: Select all

{"cloudCeiling":24000,"cloudCoverPhrase":"Cloudy","dayOfWeek":"Sunday","dayOrNight":"D","expirationTimeUtc":1591535279,"iconCode":28,"iconCodeExtend":2800,"obsQualifierCode":null,"obsQualifierSeverity":null,"precip1Hour":0,"precip6Hour":0,"precip24Hour":2.54,"pressureAltimeter":1010.16,"pressureChange":-0.68,"pressureMeanSeaLevel":1009.9,"pressureTendencyCode":2,"pressureTendencyTrend":"Falling","relativeHumidity":39,"snow1Hour":0,"snow6Hour":0,"snow24Hour":0,"sunriseTimeLocal":"2020-06-07T05:15:51+0300","sunriseTimeUtc":1591496151,"sunsetTimeLocal":"2020-06-07T21:10:52+0300","sunsetTimeUtc":1591553452,"temperature":26,"temperatureChange24Hour":0,"temperatureDewPoint":11,"temperatureFeelsLike":27,"temperatureHeatIndex":27,"temperatureMax24Hour":27,"temperatureMaxSince7Am":27,"temperatureMin24Hour":16,"temperatureWindChill":26,"uvDescription":"Moderate","uvIndex":3,"validTimeLocal":"2020-06-07T15:57:59+0300","validTimeUtc":1591534679,"visibility":14.48,"windDirection":140,"windDirectionCardinal":"SE","windGust":37,"windSpeed":24,"wxPhraseLong":"Mostly Cloudy","wxPhraseMedium":"Mostly Cloudy","wxPhraseShort":"M Cloudy"},"status":200,"statusText":"OK"}}
Screenshot of weather.com main page:
Weather.jpg

So, the phrase displayed in the wx phrase, and not the cloud cover one.
Ha ha, unfortunately the parsing part is out of my league but at least I did manage to point out the problem... :oops: :thumbup: