It is currently July 7th, 2020, 2:47 am

⭐ Weather.com - Parsing the V3 JSON

Our most popular Tips and Tricks from the Rainmeter Team and others
User avatar
jsmorley
Developer
Posts: 20995
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by jsmorley »

Edit June 17, 2020 - Ok I think I might have fixed that issue with the "long day name" and the "short day name" (and other day month values) getting out of sync for an hour or two early in the morning.

Get the .rmskin in the first post of this thread.


I'm not forcing a days worth of seconds (86400) times the number of days from "today" anymore. That approach was based on the "observation time", and at some points in the day that could get out of sync with the long name of the day being returned as a string. I'm now using a field "validTimeLocal" that is returned for each day, and I'm pretty sure, or at least hoping, that this solves the issue.
SCR
Posts: 51
Joined: April 15th, 2015, 11:13 pm

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by SCR »

jsmorley wrote:
June 17th, 2020, 12:07 pm
Yeah, It is my intent to do new versions for Moon, Pollen, and maybe AirQuality and Tides as soon as I catch my breath.
Wow, well OK then. :jawdrop That is very kind of you.

I can wait. Absolutely no rush at all. Please take your time. In the mean time I need to create some more screen real estate to accommodate then new data measures.

It would probably take about 3 to 4 months for me to come to the conclusion that the Pollen.inc is just something I can't figure out which doesn't mean I would give up, I never give up, but I'm sure my frustration level would be pretty high. :headbang:

By the way I dropped the new WeatherComJSONMeasures5Day.inc file in my weather skin and change the include name, it worked perfectly. 8-)

Thank you.
User avatar
jsmorley
Developer
Posts: 20995
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by jsmorley »

SCR wrote:
June 17th, 2020, 3:09 pm
Wow, well OK then. :jawdrop That is very kind of you.

I can wait. Absolutely no rush at all. Please take your time. In the mean time I need to create some more screen real estate to accommodate then new data measures.

It would probably take about 3 to 4 months for me to come to the conclusion that the Pollen.inc is just something I can't figure out which doesn't mean I would give up, I never give up, but I'm sure my frustration level would be pretty high. :headbang:

By the way I dropped the new WeatherComJSONMeasures5Day.inc file in my weather skin and change the include name, it worked perfectly. 8-)

Thank you.
Glad to do it.

Pollen is actually not too tough, as it is a static set of values for each day. Air Quality / Pollutants I'm not looking forward to, as that is a dynamic number of entries per day, from zero to infinite, much like Alerts are.
SCR
Posts: 51
Joined: April 15th, 2015, 11:13 pm

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by SCR »

jsmorley wrote:
June 17th, 2020, 3:15 pm
Glad to do it.

Pollen is actually not too tough, as it is a static set of values for each day. Air Quality / Pollutants I'm not looking forward to, as that is a dynamic number of entries per day, from zero to infinite, much like Alerts are.
Easy for you to say..."Not too tough" .. but for me it's monumental. I eventually managed to figure out .xml, just in time for it to go away. But the stuff you do, let's just say if a alien landed on earth and handed me a book in their language I would have a better shot at figuring that out.

I haven't had an alert here in days it's just hotter then the hinges of H... and no rain, so I'm not sure if mine is working. I use the [MeasureAlerts] in your Weather.com skin with some of my own modifications. Time will tell.
User avatar
Yincognito
Posts: 1866
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by Yincognito »

jsmorley wrote:
June 16th, 2020, 10:24 pm
Please let me know if you spot 👀 anything wrong, that inc file is a 7,000+ line, 965 measures beast now, and goodness knows I could have botched something with the tons of copy/paste and search/replace I did, don't even get me started on the RegExp involved for each "day"

RegExp=(?siU)"getSunV3DailyForecastUrlConfig":.*"duration:15day;.*"dayOfWeek":\s*\[(?:".*",\s*){0}(".*").*"narrative":\s*\[(?:".*",\s*){0}(".*").*"qpf":\s*\[(?:.*,\s*){0}(.*),.*"qpfSnow":\s*\[(?:.*,\s*){0}(.*),.*"sunriseTimeLocal":\s*\[(?:".*",\s*){0}(".*").*"sunsetTimeLocal":\s*\[(?:".*",\s*){0}(".*").*"temperatureMax":\s*\[(?:null,\s*|.*,\s*){0}(null|.*),.*"temperatureMin":\s*\[(?:null,\s*|.*,\s*){0}(null|.*),.*"cloudCover":\s*\[(?:.*,\s*){0}(.*),\s*(.*)(?:,|\]).*"dayOrNight":\s*\[(?:null,\s*|".*",\s*){0}(null|".*"),\s*(null|".*")(?:,|\]).*"daypartName":\s*\[(?:null,\s*|".*",\s*){0}(null|".*"),\s*(null|".*")(?:,|\]).*"iconCode":\s*\[(?:null,\s*|.*,\s*){0}(null|.*),\s*(null|.*)(?:,|\]).*"narrative":\s*\[(?:null,\s*|".*",\s*){0}(null|".*"),\s*(null|".*")(?:,|\]).*"precipChance":\s*\[(?:null,\s*|.*,\s*){0}(null|.*),\s*(null|.*)(?:,|\]).*"precipType":\s*\[(?:null,\s*|".*",\s*){0}(null|".*"),\s*(null|".*")(?:,|\]).*"qpf":\s*\[(?:null,\s*|.*,\s*){0}(null|.*),\s*(null|.*)(?:,|\]).*"qpfSnow":\s*\[(?:null,\s*|.*,\s*){0}(null|.*),\s*(null|.*)(?:,|\]).*"relativeHumidity":\s*\[(?:null,\s*|.*,\s*){0}(null|.*),\s*(null|.*)(?:,|\]).*"snowRange":\s*\[(?:null,\s*|".*",\s*){0}(null|".*"),\s*(null|".*")(?:,|\]).*"temperature":\s*\[(?:null,\s*|.*,\s*){0}(null|.*),\s*(null|.*)(?:,|\]).*"temperatureHeatIndex":\s*\[(?:null,\s*|.*,\s*){0}(null|.*),\s*(null|.*)(?:,|\]).*"temperatureWindChill":\s*\[(?:null,\s*|.*,\s*){0}(null|.*),\s*(null|.*)(?:,|\]).*"thunderCategory":\s*\[(?:null,\s*|".*",\s*){0}(null|".*"),\s*(null|".*")(?:,|\]).*"thunderIndex":\s*\[(?:null,\s*|.*,\s*){0}(null|.*),\s*(null|.*)(?:,|\]).*"uvDescription":\s*\[(?:null,\s*|".*",\s*){0}(null|".*"),\s*(null|".*")(?:,|\]).*"uvIndex":\s*\[(?:null,\s*|.*,\s*){0}(null|.*),\s*(null|.*)(?:,|\]).*"windDirection":\s*\[(?:null,\s*|.*,\s*){0}(null|.*),\s*(null|.*)(?:,|\]).*"windDirectionCardinal":\s*\[(?:null,\s*|".*",\s*){0}(null|".*"),\s*(null|".*")(?:,|\]).*"windPhrase":\s*\[(?:null,\s*|".*",\s*){0}(null|".*"),\s*(null|".*")(?:,|\]).*"windSpeed":\s*\[(?:null,\s*|.*,\s*){0}(null|.*),\s*(null|.*)(?:,|\]).*"wxPhraseLong":\s*\[(?:null,\s*|".*",\s*){0}(null|".*"),\s*(null|".*")(?:,|\]).*"wxPhraseShort":\s*\[(?:null,\s*|".*",\s*){0}(null|".*"),\s*(null|".*")(?:,|\])
Wow, that's a long one and a great effort. I guess I should consider myself lucky with only around 950 lines for the whole skin and just 59 weather related measures that grab most of the relevant weather data from all the main sections (excluding, of course, the many duplicates and the obvious or irrelevant fields). All in all, you've done a great job. :great:
User avatar
gt57
Posts: 15
Joined: August 31st, 2009, 4:02 am

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by gt57 »

jsmorley wrote:
June 17th, 2020, 2:48 pm
Edit June 17, 2020 - Ok I think I might have fixed that issue with the "long day name" and the "short day name" (and other day month values) getting out of sync for an hour or two early in the morning.

Get the .rmskin in the first post of this thread.


I'm not forcing a days worth of seconds (86400) times the number of days from "today" anymore. That approach was based on the "observation time", and at some points in the day that could get out of sync with the long name of the day being returned as a string. I'm now using a field "validTimeLocal" that is returned for each day, and I'm pretty sure, or at least hoping, that this solves the issue.
Looks like this did the trick. I checked various locations in the wee hours of their morning and they are sync'd up.
User avatar
jsmorley
Developer
Posts: 20995
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by jsmorley »

gt57 wrote:
June 18th, 2020, 12:57 am
Looks like this did the trick. I checked various locations in the wee hours of their morning and they are sync'd up.
Excellent... Thanks.
User avatar
ikarus1969
Posts: 358
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by ikarus1969 »

jsmorley wrote:
June 17th, 2020, 12:07 pm
Yeah, It is my intent to do new versions for Moon, Pollen, and maybe AirQuality and Tides as soon as I catch my breath.
In case you've already caught your breath :) if not seen by you already i want to direct your attention to the following error in the moon-include.
It doesn't deliver the phase icons anymore. Instead the phase days are delivered.
Maybe there can be measures about both the days (the "age" of the moon) and of course the icon
RM Screenshot # 1.jpg
RM Screenshot # 2.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Posts: 1866
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by Yincognito »

ikarus1969 wrote:
June 18th, 2020, 5:51 am
In case you've already caught your breath :) if not seen by you already i want to direct your attention to the following error in the moon-include.
It doesn't deliver the phase icons anymore. Instead the phase days are delivered.
Maybe there can be measures about both the days (the "age" of the moon) and of course the icon

RM Screenshot # 1.jpg
RM Screenshot # 2.jpg
Apart from your observation (which will probably be handled by jsmorley accordingly), just for information purposes, technically one could display more accurate representations of the moon phase based on the moon "age" / days value and the latitude (assuming the 29 or 30 moon icons for each day are already available, that is).
User avatar
jsmorley
Developer
Posts: 20995
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by jsmorley »

ikarus1969 wrote:
June 18th, 2020, 5:51 am
In case you've already caught your breath :) if not seen by you already i want to direct your attention to the following error in the moon-include.
It doesn't deliver the phase icons anymore. Instead the phase days are delivered.
Maybe there can be measures about both the days (the "age" of the moon) and of course the icon

RM Screenshot # 1.jpg
RM Screenshot # 2.jpg
I'll be working on the moon stuff this afternoon.