It is currently June 21st, 2024, 8:14 pm

⭐ Weather.com - Parsing the V3 JSON

Our most popular Tips and Tricks from the Rainmeter Team and others
User avatar
Yincognito
Rainmeter Sage
Posts: 7471
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by Yincognito »

jsmorley wrote: June 5th, 2020, 5:52 pm Huh. I get "h" for the units when I set en-GB as the language.



1.jpg
Huh myself, as I don't (screenshot from my file manager's file comparison, the en-US on the left, the en-GB on the right, the differences in red):
Weather.com V3 en-US vs en-GB.jpg
By the way, I used the latitude and longitude URL format, not the code based one. Maybe that's the explanation for the difference? :confused:
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22640
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by jsmorley »

Dunno. Works as expected for me with LocationCode=38.7230934,-77.0690415 and Language=en-GB


1.jpg


In any case, if you are not using the @Include files from the first post in the thread, then we are just not talking about apples and apples here.
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7471
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by Yincognito »

jsmorley wrote: June 5th, 2020, 6:32 pm Dunno. Works as expected for me with LocationCode=38.7230934,-77.0690415 and Language=en-GB



1.jpg



In any case, if you are not using the @Include files from the first post in the thread, then we are just not talking about apples and apples here.
Yeah, it has nothing to do with the include files, and nothing to do with apples and oranges either. I know what you'll say, you're interested in what and how your include files work and behave and that's fair enough ... but it has been proven before (just about since a week or two ago, LOL) that how the source is served from the site is key. After all, this is how the problems started: you got one thing in the browser and another in WebParser (I'm not going to tell you that I told you so :sly: ).

Long story short, after investigating the matter, your skin provides the same things in my case (as per your screenshot), given the same settings, so that's one thing that works as expected. However (and hopefully it won't cause similar issues in the future, although I wouldn't hold my breath on this one), what is served to the browser (the mundane Chrome for me) is still different from what is served to WebParser. It's not the user agent, it's not the force reload, it's not the location (I'm detected in the same location in both circumstances), it's not the "usual suspects", because I toggled them all to find why it happens, but if I enter the same URL in the browser as it's used in your skin (so relax, I'm not talking about my off-topic oranges, but about your on-topic apples, LOL) I get different results in terms of units. Search for units: or twc-unit in the page source from the browser's and you'll see what I mean (if you get the same thing, that is).

As I said, I hope this won't be the source of similar issues in the future (and also hope that the differences are limited to units and other "non-essential" stuff), but I'd be curious if you are also getting different results in the browser compared to your (or whichever, for that matter) skin / WebParser. As for the explanation for this, I have the bad feeling that we're going to talk again about those damn cookies or whatever... :???:

EDIT: Forgot to say it, but the file size is different too. WebParser's debug is getting me a 700 Kb file, while the page source from the browser is 2 MB. Hopefully that's just the result of Unicode encoding, though I doubt it since it should be the same. Yep, it's the result of the encoding, just saved the same page source the same way a couple of seconds apart, and they are both around 900 Kb. They are different though - will check and see just how much.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22640
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by jsmorley »

Yeah, you are right... 😈 What is returned by your browser, which is who knows what version of what browser on what version of what OS and what level of OS updates.... Doesn't particularly interest me. Rainmeter skins are always going to use WebParser, and that uses the API calls for Internet Explorer, and that is all that matters really. In my view, the only way to compare apples to apples is to use Debug=2 with WebParser. Then what you end up with is what Rainmeter gets.

I currently have the UserAgent set in my @Include file to be a "mobile" browser user agent string, as it looked like for a little while there that that made some difference. I actually don't think it does anymore, but I don't think it will hurt to leave that there.

The size for me for the entire site when I use Debug=2 is 739 KB (757,443 bytes). I expect that the "super" parent measure that gets the entire site could be narrowed to just get the big block of JSON and that might be somewhat smaller, but to be honest I don't really care that much. Downloading less than a megabyte, once every 10 minutes, is not going to keep me up at night.
User avatar
Yincognito
Rainmeter Sage
Posts: 7471
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by Yincognito »

jsmorley wrote: June 5th, 2020, 8:18 pmYeah, you are right... 😈 What is returned by your browser, which is who knows what version of what browser on what version of what OS and what level of OS updates.... Doesn't particularly interest me.
Got it - you have a point.

Actually, just finished comparing, it's only the units being different ... and the application id:

Code: Select all

                applicationID: "296284989", <- Chrome
                applicationID: "296284162", <- Rainmeter's WebParser Plugin
The JS on the site is running some things based on that ID, but as you said, it bears little relevance to the overall result, since the differences are minimal. I believe that letting the mobile user agent there is a good idea, just in case - something of a "backup plan" if needed and still functional.

Bottom line, it's all good, I thought it was more serious. Now if it lasts, then that would be perfect. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22640
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 5th, 2020, 8:43 pm Got it - you have a point.

Actually, just finished comparing, it's only the units being different ... and the application id:

Code: Select all

                applicationID: "296284989", <- Chrome
                applicationID: "296284162", <- Rainmeter's WebParser Plugin
The JS on the site is running some things based on that ID, but as you said, it bears little relevance to the overall result, since the differences are minimal. I believe that letting the mobile user agent there is a good idea, just in case - something of a "backup plan" if needed and still functional.

Bottom line, it's all good, I thought it was more serious. Now if it lasts, then that would be perfect. ;-)
That's for sure. Nobody enjoys this kind of kerfuffle much...
User avatar
Yincognito
Rainmeter Sage
Posts: 7471
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by Yincognito »

jsmorley wrote: June 5th, 2020, 8:45 pm That's for sure. Nobody enjoys this kind of kerfuffle much...
At least I'm enriching my English vocabulary in the meantime. :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Mirage
Posts: 23
Joined: September 11th, 2012, 3:36 am

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by Mirage »

I'm finding this whole V3 change thing very interesting. And I'm glad to see so mush effort being applied to this issue. Thanks to all. Question, does the new JSON still supply Moonrise and Moonset times?

Thanks again for all your effort.
OnyxBlack
Posts: 27
Joined: June 3rd, 2020, 10:06 am

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by OnyxBlack »

Mirage wrote: June 5th, 2020, 10:11 pm I'm finding this whole V3 change thing very interesting. And I'm glad to see so mush effort being applied to this issue. Thanks to all. Question, does the new JSON still supply Moonrise and Moonset times?

Thanks again for all your effort.
Yes, Lycanthropes can safely use these measures again.
User avatar
Mirage
Posts: 23
Joined: September 11th, 2012, 3:36 am

Re: ⭐ Weather.com - Parsing the V3 JSON

Post by Mirage »

OnyxBlack wrote: June 5th, 2020, 11:14 pm Yes, Lycanthropes can safely use these measures again.
How did you know OnyxBlack? :) Which measures are you referring to? I don't seem to see anything for Moon times?