I don’t really have any experience with this type of stuff, where do I go to change the API key? The Rainmeter skin or the weather.com site?
It is currently September 16th, 2024, 9:05 am
Weather Skins Not Working
-
- Posts: 8
- Joined: January 10th, 2022, 10:37 pm
Re: Weather Skins Not Working
-
- Rainmeter Sage
- Posts: 8146
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Weather Skins Not Working
Change the value of the APIKey variable from [YourSkin]\@Resources\WeatherComJSONVariables.inc file (you should typically have such a file included in your skin). I might write a little skin that does that on a mouse click later on, if anyone would be interested.
-
- Rainmeter Sage
- Posts: 2736
- Joined: March 23rd, 2015, 5:26 pm
-
- Rainmeter Sage
- Posts: 8146
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Weather Skins Not Working
A little skin that changes the key for you on left click:
The only thing you'd need to modify here is the value of the SkinName variable to the name of your desired skin (i.e. Weather.com for jsmorley's skin, Gadgets for Silver Azide's gadgets, etc), refresh it and click it. This assumes that the WeatherComJSONVariables.inc file is directly in the @Resources folder of your skin.
Obviously, if your skin or its WeatherComJSONVariables.inc file are located in a more obfuscated path than the "standard" one, you'd need to change the SkinName value or the path used in the LeftMouseAction above accordingly.
P.S. I didn't add any bells and whistles (like InputText measures, buttons, etc.) to the code, it's just the bare minimum.
P.S.S. This skin should stand the "test of time", if weather.com's page source keeps its existing format. If the name of the field that the key is stored under in the page source changes in the future, you'd need to adjust the value of the APIKeyLabel variable as well.
Code: Select all
[Variables]
APIKeyLabel=SUN_V3_API_KEY_CLIENT
SkinName=Weather.com
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=47,47,47,255
---Measures---
[APIKeyValue]
Measure=WebParser
URL=https://weather.com
RegExp=(?siU)"#APIKeyLabel#":"(.*)"
StringIndex=1
UpdateRate=-1
---Meters---
[APIKey]
Meter=String
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontSize=16
AntiAlias=1
MeasureName=APIKeyValue
Text="API Key: %1"
LeftMouseUpAction=[!WriteKeyValue Variables APIKey "[APIKeyValue]" "#SKINSPATH##SkinName#\@Resources\WeatherComJSONVariables.inc"]
DynamicVariables=1
Obviously, if your skin or its WeatherComJSONVariables.inc file are located in a more obfuscated path than the "standard" one, you'd need to change the SkinName value or the path used in the LeftMouseAction above accordingly.
P.S. I didn't add any bells and whistles (like InputText measures, buttons, etc.) to the code, it's just the bare minimum.
P.S.S. This skin should stand the "test of time", if weather.com's page source keeps its existing format. If the name of the field that the key is stored under in the page source changes in the future, you'd need to adjust the value of the APIKeyLabel variable as well.
-
- Posts: 85
- Joined: July 17th, 2016, 12:19 pm
Re: Weather Skins Not Working
Where did you find that? I have the same file open, but nothing like "api", "key" oder "V3" is included.
-
- Posts: 85
- Joined: July 17th, 2016, 12:19 pm
Re: Weather Skins Not Working
You didn't mention where to paste that code into. I have no idea, what to do with it. Is everybody here a Rainmeter expert?Yincognito wrote: ↑January 10th, 2022, 11:22 pm A little skin that changes the key for you on left click:The only thing you'd need to modify here is the value of the SkinName variable to the name of your desired skin (i.e. Weather.com for jsmorley's skin, Gadgets for Silver Azide's gadgets, etc), refresh it and click it. This assumes that the WeatherComJSONVariables.inc file is directly in the @Resources folder of your skin.Code: Select all
[Variables] APIKeyLabel=SUN_V3_API_KEY_CLIENT SkinName=Weather.com [Rainmeter] Update=1000 DynamicWindowSize=1 AccurateText=1 BackgroundMode=2 SolidColor=47,47,47,255 ---Measures--- [APIKeyValue] Measure=WebParser URL=https://weather.com RegExp=(?siU)"#APIKeyLabel#":"(.*)" StringIndex=1 UpdateRate=-1 ---Meters--- [APIKey] Meter=String FontFace=Consolas FontColor=255,255,255,255 SolidColor=47,47,47,255 Padding=5,5,5,5 FontSize=16 AntiAlias=1 MeasureName=APIKeyValue Text="API Key: %1" LeftMouseUpAction=[!WriteKeyValue Variables APIKey "[APIKeyValue]" "#SKINSPATH##SkinName#\@Resources\WeatherComJSONVariables.inc"] DynamicVariables=1
Obviously, if your skin or its WeatherComJSONVariables.inc file are located in a more obfuscated path than the "standard" one, you'd need to change the SkinName value or the path used in the LeftMouseAction above accordingly.
P.S. I didn't add any bells and whistles (like InputText measures, buttons, etc.) to the code, it's just the bare minimum.
P.S.S. This skin should stand the "test of time", if weather.com's page source keeps its existing format. If the name of the field that the key is stored under in the page source changes in the future, you'd need to adjust the value of the APIKeyLabel variable as well.
-
- Rainmeter Sage
- Posts: 8146
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Weather Skins Not Working
If you're talking about the VClouds Weather 2 skin, it appears that the author commented (i.e. disabled) the variables in that file. They seem to be in the ...\@Resources\UserVariablesH.inc and ...\@Resources\UserVariables.inc instead, so look into those to change the variable.
This should be pasted into a new skin file (i.e. an .ini file in a folder within your skins folder) or create a new skin to paste the code into... but the skin I wrote won't do what you want in that case, since the location of the variable changed, and you probably won't realize what to do to adjust to the different scenario. Better do what I advised above, it's more or less the same thing but simpler.
If that doesn't yield the expected result, just F3 (i.e. Find a text) into the .inc files from @Resources folder for the "APIKey" string, or the previous value of that key, if by any chance the name of the variable was changed by the author as well.
EDIT: Or, if you find it too complicated, you can share which skin you're talking about (or a link to it) and maybe we'll be able to help then.
Last edited by Yincognito on January 11th, 2022, 1:15 am, edited 1 time in total.
-
- Posts: 85
- Joined: July 17th, 2016, 12:19 pm
Re: Weather Skins Not Working
It's Gadgets by Silverazide. There is no Api key in WeatherComJSONVariables.inc whatsoever, that i could replace.Yincognito wrote: ↑January 11th, 2022, 1:09 am If you're talking about the VClouds Weather 2 skin, it appears that the author commented (i.e. disabled) the variables in that file. They seem to be in the ...\@Resources\UserVariablesH.inc and ...\@Resources\UserVariables.inc instead, so look into those to change the variable.
This should be pasted into a new skin file (i.e. an .ini file in a folder within your skins folder) or create a new skin to paste the code into... but the skin I wrote won't do what you want in that case, since the location of the variables changed, and you probably won't realize what to do to adjust to the different scenario. Better do what I advised above.
If that doesn't yield the expected result, just F3 (i.e. Find a text) into the .inc files from @Resources folder for the "APIKey" string, or the previous value of that key, if by any chance the name of the variable was changed by the author as well.
-
- Rainmeter Sage
- Posts: 8146
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Weather Skins Not Working
Well, Silver Azide already updated his skins, as it can be seen in the previous replies. And yes, there IS an APIKey variable in the ...\Gadgets\@Resources\WeatherComJSONVariables.inc, at least that's what I see in my Gadgets. My skin also works on his Gadgets too, if that matters.
-
- Posts: 85
- Joined: July 17th, 2016, 12:19 pm
Re: Weather Skins Not Working
Sorry, i just can't find any link to the updated version anywhere. Is this the right code (it's from WeatherComJSONVariables.inc)?
If so, i have no idea where that API code would be, that i should repace.
If so, i have no idea where that API code would be, that i should repace.
Code: Select all
[Variables]
; If another language or unit(s) of measures are desired the correct code can be found at:
; https://admin.rainmeter.net/LanguageCodes.php
; For example, French as used in France would be Language=fr-FR
; The unit(s) of measure are automatic, based on the language.
; For instance, you cannot have the language be French, but the units be F imperial.
; Note however, that simply changing from imperial F to metric C units of measure while keeping the
; language as English can be done by using en-GB as the Language.
Language=#LocaleName#
; How often to update the weather information. Default and recommended is 600, which would be 10 minutes.
UpdateRate=#WxUpdateInterval#
; Date and time formats you desire.
; See https://docs.rainmeter.net/manual/measures/time/#FormatCodes
; For formatting codes to use.
DateFormat=#FmtDate#
TimeFormat=#FmtTime#
; Getting and setting your LocationCode can be done one of several ways.
;
; The EASIEST and likely BEST way is to right-click the skin and select "Choose Location"
;
; This will allow you to search for and use the weather.com Location ID.
; This uses the database described at https://forum.rainmeter.net/viewtopic.php?f=118&t=34714
; Example : LocationCode=USVA0944
;
; Search for your Country and Location, then just click the Location ID that you want.
; Your LocationCode will be set, and your skin will be refreshed to use it. Done...
; Note: You can click the Location Name, to go to Google Maps and confirm your choice.
;
; More manual alternatives are:
;
; Go to https://weather.com/
; Search for your city until you get the location you want.
; Use the long Canonical ID number at the end of the resulting URL, for example:
; https://weather.com/weather/today/l/1665d9e3052c3448be48dafc1587318a27ee85516e97e0b5376043cd41a4f0e8
; Copy and enter that as the value for the LocationCode.
; Example : LocationCode=1665d9e3052c3448be48dafc1587318a27ee85516e97e0b5376043cd41a4f0e8
;
; You can also use your Latitude,Longitude retrieved from https://google.com/maps in this format:
; Example : LocationCode=38.7230934,-77.0690415
; In the USA, you can simply use your ZipCode as the LocationCode.
; Example : LocationCode=22308
LocationCode=#Location#
; Don't change any below here.
CommonSubstitute='"':"","^null$":"","\\u002F":"/","\\u005C":"\","\\u003C":"<","\\u003E":">"
URLSite=https://weather.com/#Language#/weather/today/l/#LocationCode#