It is currently September 18th, 2024, 1:04 pm

Weather Skins Not Working

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 8171
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Skins Not Working

Post by Yincognito »

balala wrote: August 28th, 2024, 6:13 pm Don't know over time, but right now at least, the weather.com seems to be working even with no UserAgent defined. Nominatim.com doesn't, but weather.com does.
Really? Well, obviously I believe you, I just can't remember the exact reason why we decided to use a browser user agent for the weather.com skins at the time we were building them. It might have been simply for the "peace of mind" that the site won't reject our requests, or even a remnant from the time when we used to parse the entire weather.com page instead of just the .json request... :???:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16552
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather Skins Not Working

Post by balala »

Yincognito wrote: August 28th, 2024, 7:32 pm Really? Well, obviously I believe you, I just can't remember the exact reason why we decided to use a browser user agent for the weather.com skins at the time we were building them. It might have been simply for the "peace of mind" that the site won't reject our requests, or even a remnant from the time when we used to parse the entire weather.com page instead of just the .json request... :???:
Just try it out, I am curious if it's going on the same way on your side. In fact I'm using a UserAgent as well on the parent measure getting the weather data, but just removed it (in fact commented it out) to see if it is working. And it did.
User avatar
Yincognito
Rainmeter Sage
Posts: 8171
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Skins Not Working

Post by Yincognito »

balala wrote: August 28th, 2024, 7:44 pm Just try it out, I am curious if it's going on the same way on your side. In fact I'm using a UserAgent as well on the parent measure getting the weather data, but just removed it (in fact commented it out) to see if it is working. And it did.
I did try it out like you suggested, and it indeed works with the UserAgent option commented out (I tried this in my skin suite, which doesn't use jsmorley's .inc files, but it shouldn't matter). That being said, I still feel much more on the "safe side" by using a browser like user agent, you never know when they decide to only allow browser initiated requests to their data, in a way somewhat similar to how Nominatim reacted, so I'll keep it going forward. :)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16552
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather Skins Not Working

Post by balala »

Yincognito wrote: August 28th, 2024, 7:53 pm That being said, I still feel much more on the "safe side" by using a browser like user agent, you never know when they decide to only allow browser initiated requests to their data, in a way somewhat similar to how Nominatim reacted, so I'll keep it going forward. :)
Definitely. Same here as well.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2738
Joined: March 23rd, 2015, 5:26 pm

Re: Weather Skins Not Working

Post by SilverAzide »

Yincognito wrote: August 28th, 2024, 7:32 pm I just can't remember the exact reason why we decided to use a browser user agent for the weather.com skins at the time we were building them. It might have been simply for the "peace of mind" that the site won't reject our requests, or even a remnant from the time when we used to parse the entire weather.com page instead of just the .json request... :???:
If I recall correctly, we started doing this when weather.com started some shenanigans and changing their HTML's "scrape-ability" by detecting user agents but DID NOT do those same shenanigans if your user agent was a mobile browser. Eventually they stopped this, but we kept the user agent to ensure the shenanigans would not return.

Probably not needed now at all since we transitioned to using their API, but best to not poke the bear at this point.
Gadgets Wiki GitHub More Gadgets...
AwkhamsRazor
Posts: 2
Joined: August 28th, 2024, 11:03 pm

Re: Weather Skins Not Working

Post by AwkhamsRazor »

Hey folks, so I'm brand new to Rainmeter. I've used TranslucentTB and Wallpaper Engine to customize my Windows 11 experience, but that's all.

I got the Sonder skin from here: https://github.com/mpurses/Sonder/projects/1

It works great, except the Weather is broken (as you all know). I'm hoping you can help me sort it out as a lot of the fixes I've seen posted in here are either very complex, or they haven't worked for me. II just reinstalled Sonder so I can troubleshoot fresh.

Notes that might matter:
-The only skins I have installed are the default Illustro and Sonder.
-I'm only using elements of Sonder.
-The API key in the variables.inc file is correct.
-I tried setting my lat and long manually, and for one minute the widget worked, but then it went back to being blank. I have yet to be able to replicate that.

Any help you can offer would be great! Sorry for the trouble!

EDIT: I did notice that WeatherComJSONVariables.inc has two lines with different API keys...
; Don't change any below here.
;APIKey=d522aa97197fd864d36b418f39ebb323
;APIKey=21d8a80b3d6b444998a80b3d6b1449d3
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0
Should I update these too?
User avatar
Yincognito
Rainmeter Sage
Posts: 8171
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Skins Not Working

Post by Yincognito »

SilverAzide wrote: August 28th, 2024, 10:23 pm If I recall correctly, we started doing this when weather.com started some shenanigans and changing their HTML's "scrape-ability" by detecting user agents but DID NOT do those same shenanigans if your user agent was a mobile browser. Eventually they stopped this, but we kept the user agent to ensure the shenanigans would not return.

Probably not needed now at all since we transitioned to using their API, but best to not poke the bear at this point.
Yep, you're right, now I remember it too - thanks for refreshing my memory. Indeed, if it ain't broken, don't fix it. :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 8171
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Skins Not Working

Post by Yincognito »

AwkhamsRazor wrote: August 28th, 2024, 11:09 pm EDIT: I did notice that WeatherComJSONVariables.inc has two lines with different API keys...

Should I update these too?
That skin you linked to it's a bit of a mess in regard to where it gets its variables from. There are lots of commented lines in the code (commented lines are preceded by the ; symbol, and are ignored by Rainmeter), so it's a little difficult to figure out where such values come from. Anyway, it looks like the file you mentioned above isn't used in the skin, but Variables.inc is, so if you're certain that the api key in the latter is the current one, the weather should work.

I'm not able to actually test the skin at this time, so, unless someone else answers this in the meantime, you'll have to wait until tomorrow for my reply. As far as I could tell just by looking at the code, if you changed the latitude and longitude variables in Variables.inc, it should again work... but I suspect only if some or all of the Auto... variables above them are set to 0 or possibly made blank.

EDIT: Well, in the end I did quickly test it, and my suspicion was correct. Basically, in your [SkinsFolder]\Sonder\@Resources\Variables.inc from the Sonder 22.1.0 version, you should have something along these lines in order to set your location manually from the code:

Code: Select all

;***New Weather API Variables***
APIKey=71f92ea9dd2f4790b92ea9dd2f779061
...
AutoDetectLocation=0
AutoLatLong=1
AutoDetectCity=Could not detect  
;Latitude & Longitude will automatically change from AutoDetectCity value if AutoLatLong equals 1
Latitude=...
Longitude=...
The ... parts are either the existing code in that area, or the decimal latitude and longitude of your desired location to display the weather for.

By the way, these things are supposed to be modified in a much more comfortable / user friendly fashion by right clicking the skin (I used [SkinsFolder]\Sonder\Weather\Weather.ini for testing) and choosing Weather Settings... from the skin's context menu. In case you don't know it yet, the skins folder is typically this for a standard Rainmeter installation.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
AwkhamsRazor
Posts: 2
Joined: August 28th, 2024, 11:03 pm

Re: Weather Skins Not Working

Post by AwkhamsRazor »

Yincognito wrote: August 29th, 2024, 12:36 am That skin you linked to it's a bit of a mess in regard to where it gets its variables from. There are lots of commented lines in the code (commented lines are preceded by the ; symbol, and are ignored by Rainmeter), so it's a little difficult to figure out where such values come from. Anyway, it looks like the file you mentioned above isn't used in the skin, but Variables.inc is, so if you're certain that the api key in the latter is the current one, the weather should work.

I'm not able to actually test the skin at this time, so, unless someone else answers this in the meantime, you'll have to wait until tomorrow for my reply. As far as I could tell just by looking at the code, if you changed the latitude and longitude variables in Variables.inc, it should again work... but I suspect only if some or all of the Auto... variables above them are set to 0 or possibly made blank.

EDIT: Well, in the end I did quickly test it, and my suspicion was correct. Basically, in your [SkinsFolder]\Sonder\@Resources\Variables.inc from the Sonder 22.1.0 version, you should have something along these lines in order to set your location manually from the code:

Code: Select all

;***New Weather API Variables***
APIKey=71f92ea9dd2f4790b92ea9dd2f779061
...
AutoDetectLocation=0
AutoLatLong=1
AutoDetectCity=Could not detect  
;Latitude & Longitude will automatically change from AutoDetectCity value if AutoLatLong equals 1
Latitude=...
Longitude=...
The ... parts are either the existing code in that area, or the decimal latitude and longitude of your desired location to display the weather for.

By the way, these things are supposed to be modified in a much more comfortable / user friendly fashion by right clicking the skin (I used [SkinsFolder]\Sonder\Weather\Weather.ini for testing) and choosing Weather Settings... from the skin's context menu. In case you don't know it yet, the skins folder is typically this for a standard Rainmeter installation.
Got it! I removed the 0 and 1 and Could not detect entries and plugged in my actual lat and long and saved and this time it worked. I'll update if it resets again, but I think I'm all set now. Thank you! :)
User avatar
Yincognito
Rainmeter Sage
Posts: 8171
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Skins Not Working

Post by Yincognito »

AwkhamsRazor wrote: August 29th, 2024, 2:22 am Got it! I removed the 0 and 1 and Could not detect entries and plugged in my actual lat and long and saved and this time it worked. I'll update if it resets again, but I think I'm all set now. Thank you! :)
You're welcome, glad it worked! :great:

Just a small observation: if you remove these variables entirely, you'll probably have some errors in the log regarding this. If that bothers you, a "safer" way to approach this is to leave those lines but make sure the value of the AutoDetectLocation variable is set to 0, just like in the code part I mentioned above. I think that's the only variable that needs to not be 1 in order for custom aka not autodetected coordinates to work, like you wanted.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth