It is currently October 15th, 2021, 11:10 pm

Weatherbox

Weather skins
Carpus
Posts: 2
Joined: May 30th, 2020, 4:47 pm

Re: Weatherbox

Post by Carpus »

For the last few day I'm just getting a 'wrong format' message. It shows my location when I refresh, but then I get the error.



Weather.png
You do not have the required permissions to view the files attached to this post.
User avatar
Lieuallen
Posts: 24
Joined: June 8th, 2020, 11:56 pm
Location: USA

Re: Weatherbox

Post by Lieuallen »

Please read this thread.
"Imagination is more important than knowledge." -- Albert Einstein
User avatar
Yincognito
Rainmeter Sage
Posts: 4063
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weatherbox

Post by Yincognito »

dvo wrote: July 30th, 2020, 10:08 pm I was explaining what happend with his script if answering a post is already a bad thing i will stop helping ... :thumbdown:
I don't think that this is what Lieuallen meant with his post. In other words, I don't think he was referring to the fact that you (or any other users interested in the topic) shouldn't reply here, but more to the fact that reading the other thread can be useful to understand what exactly happened in the weather.com page source and how it can be fixed.
User avatar
QuakeGuy
Posts: 30
Joined: February 3rd, 2020, 11:15 pm
Location: Germany

Re: Weatherbox

Post by QuakeGuy »

I also noticed the skin stopped working again this week. I had no time so far to check the problem, only saw the pink Corvid-19 look is gone.

I will fix the skin hoppefully this weekend...
User avatar
QuakeGuy
Posts: 30
Joined: February 3rd, 2020, 11:15 pm
Location: Germany

Re: Weatherbox

Post by QuakeGuy »

The problem got fixed in the new release. The JSON v3 code at the end of the weather.com-html masked the char " with \".

I also moved the user settings to a separate inc-file. In future versions settings won't be overridden.
User avatar
QuakeGuy
Posts: 30
Joined: February 3rd, 2020, 11:15 pm
Location: Germany

Re: Weatherbox

Post by QuakeGuy »

What the heck? :? Today my skin stopped working again. After a investigation of the situation i realized, they only changed the part getSunV3DailyForecastUrlConfig to getSunV3DailyForecastWithHeadersUrlConfig.

I get the feeling they do this small changes on purpose. Anyways, if this is still the case tomorrow i will release a tiny update/fix.
User avatar
Yincognito
Rainmeter Sage
Posts: 4063
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weatherbox

Post by Yincognito »

QuakeGuy wrote: August 21st, 2020, 3:50 pm What the heck? :? Today my skin stopped working again. After a investigation of the situation i realized, they only changed the part getSunV3DailyForecastUrlConfig to getSunV3DailyForecastWithHeadersUrlConfig.

I get the feeling they do this small changes on purpose. Anyways, if this is still the case tomorrow i will release a tiny update/fix.
And added a responseHeaders subsection at the end of the forecast section, yes. The changes are minor and it can be that they do such things on purpose, but it is what it is. I keep telling people to make their weather skin regex patterns as flexible as possible, at least for the main site JSON, but apparently folks never learn and believe it's too complicated, prefering to rebuild their skins over and over each time such a change occurs. :confused: For example, in my skin, the pattern getting the forecast is stored in a variable which then gets used in the parsing, and was like:

DailyForecast=#Q#(?=[^"]*daily)(?=[^"]*forecast)[^"]*#Q#:(?:(?=.*15day).*15day|)[^\}]*([\{\[]{1}.*[\]\}]{4}+)

where #Q# is just another variable used to store either the unescaped (") or escaped (\") quote, so that I can parse both the main site JSON and the API one using the same regexes. Given the way the patterns are built, no name modification was needed for the change in the forecast section name (it works with both getSunV3DailyForecastUrlConfig and getSunV3DailyForecastWithHeadersUrlConfig) and the only change that was needed to make it work again for the main site JSON was making the number or curly brackets at the end flexible as well (since as I mentioned, they added a new subsection inside the forecast one, which means either less or more brackets here are there), like:

DailyForecast=#Q#(?=[^"]*daily)(?=[^"]*forecast)[^"]*#Q#:(?:(?=.*15day).*15day|)[^\}]*([\{\[]{1}.*[\]\}]{3,4}+)

and that was it. But then, I have to admit, my way doesn't suit everyone, of course, first because it requires a bit more advanced knowledge of regex nd secondly because it's tailored to my skin's approach on things.
User avatar
QuakeGuy
Posts: 30
Joined: February 3rd, 2020, 11:15 pm
Location: Germany

Re: Weatherbox

Post by QuakeGuy »

Yincognito your dynamic approach accessing the JSON sounds interesting. For now i made my regex a bit less static, leaving UrlConfig at the end of each section. We will see how weather.com changes in the near future. Maybe i will rework the JSON access if it needs updates too often.

Btw the fix with version 2.01 is uploaded.
User avatar
Yincognito
Rainmeter Sage
Posts: 4063
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weatherbox

Post by Yincognito »

QuakeGuy wrote: August 23rd, 2020, 2:26 pm Yincognito your dynamic approach accessing the JSON sounds interesting. For now i made my regex a bit less static, leaving UrlConfig at the end of each section. We will see how weather.com changes in the near future. Maybe i will rework the JSON access if it needs updates too often.

Btw the fix with version 2.01 is uploaded.
Yeah, it's a bit of a trade off: while the dynamic code offers great flexibility and easier adaptation to changes, the patterns are a bit harder to understand compared to hardcoded ones. It works for me though - I promised myself that I won't rebuild my skin from scratch again on weather.com changes and so far this approach made it possible (along with being able to parse the V2 site JSON, the V3 site JSON and the V3 API JSON using the same regex patterns, so I can easily switch from getting the data from the main page or the API response).