Correct...

Correct...
Simply replace the contents of WeatherComJSONAlerts.inc with this:SilverAzide wrote: ↑August 1st, 2020, 9:24 pm Correct...Although for me it is barfing on not having any alerts even at the start, but on the second refresh (the first is always clean).
Code: Select all
; =================================================================================================
; WeatherComJSONAlerts.inc by JSMorley
; "Weather.com - Parsing the JSON" (https://forum.rainmeter.net/viewtopic.php?f=118&t=34628)
;
; Requires that WeatherComJSONVariables.inc and WeatherComJSONMeasures.inc
; be @Included in the skin before this file.
;
; Updated July 31, 2020
; ==================================================================================================
[@AlertsParent]
Measure=WebParser
Group=Parents
URL=[@EntireSiteSuperParent]
Disabled=1
LogSubstringErrors=0
StringIndex=1
RegExp=(?siU)"v3alertsHeadlines":(?(?=.*{.*,"alerts":).*{.*,"alerts":.*(?(?=.*{"detailKey").*:".*",.*,"eventDescription":"(.*)","severityCode":(.*),"severity":"(.*)",.*,"headlineText":"(.*)",.*}).*(?(?=.*{"detailKey").*:".*",.*,"eventDescription":"(.*)","severityCode":(.*),"severity":"(.*)",.*,"headlineText":"(.*)",.*}).*(?(?=.*{"detailKey").*:".*",.*,"eventDescription":"(.*)","severityCode":(.*),"severity":"(.*)",.*,"headlineText":"(.*)",.*}).*(?(?=.*{"detailKey").*:".*",.*,"eventDescription":"(.*)","severityCode":(.*),"severity":"(.*)",.*,"headlineText":"(.*)",.*}).*(?(?=.*{"detailKey").*:".*",.*,"eventDescription":"(.*)","severityCode":(.*),"severity":"(.*)",.*,"headlineText":"(.*)",.*}).*(?(?=.*{"detailKey").*:".*",.*,"eventDescription":"(.*)","severityCode":(.*),"severity":"(.*)",.*,"headlineText":"(.*)",.*}).*(?(?=.*{"detailKey").*:".*",.*,"eventDescription":"(.*)","severityCode":(.*),"severity":"(.*)",.*,"headlineText":"(.*)",.*}).*(?(?=.*{"detailKey").*:".*",.*,"eventDescription":"(.*)","severityCode":(.*),"severity":"(.*)",.*,"headlineText":"(.*)",.*}).*)
[@Alert1Description]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=1
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#CommonSubstitute#
DynamicVariables=1
[@Alert1SeverityCode]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=2
Substitute=#CommonSubstitute#
[@Alert1Severity]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=3
Substitute=#CommonSubstitute#
[@Alert1Text]
Measure=WebParser
Url=[@AlertsParent]
DecodeCharacterReference=1
StringIndex=4
Substitute=#CommonSubstitute#
[@Alert2Description]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=5
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#CommonSubstitute#
DynamicVariables=1
[@Alert2SeverityCode]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=6
Substitute=#CommonSubstitute#
[@Alert2Severity]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=7
Substitute=#CommonSubstitute#
[@Alert2Text]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=8
DecodeCharacterReference=1
Substitute=#CommonSubstitute#
[@Alert3Description]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=9
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#CommonSubstitute#
DynamicVariables=1
[@Alert3SeverityCode]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=10
Substitute=#CommonSubstitute#
[@Alert3Severity]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=11
Substitute=#CommonSubstitute#
[@Alert3Text]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=12
DecodeCharacterReference=1
Substitute=#CommonSubstitute#
[@Alert4Description]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=13
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#CommonSubstitute#
DynamicVariables=1
[@Alert4SeverityCode]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=14
Substitute=#CommonSubstitute#
[@Alert4Severity]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=15
Substitute=#CommonSubstitute#
[@Alert4Text]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=16
DecodeCharacterReference=1
Substitute=#CommonSubstitute#
[@Alert5Description]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=17
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#CommonSubstitute#
DynamicVariables=1
[@Alert5SeverityCode]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=18
Substitute=#CommonSubstitute#
[@Alert5Severity]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=19
Substitute=#CommonSubstitute#
[@Alert5Text]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=20
DecodeCharacterReference=1
Substitute=#CommonSubstitute#
[@Alert6Description]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=21
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#CommonSubstitute#
DynamicVariables=1
[@Alert6SeverityCode]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=22
Substitute=#CommonSubstitute#
[@Alert6Severity]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=23
Substitute=#CommonSubstitute#
[@Alert6Text]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=24
DecodeCharacterReference=1
Substitute=#CommonSubstitute#
[@Alert7Description]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=25
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#CommonSubstitute#
DynamicVariables=1
[@Alert7SeverityCode]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=26
Substitute=#CommonSubstitute#
[@Alert7Severity]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=27
Substitute=#CommonSubstitute#
[@Alert7Text]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=28
DecodeCharacterReference=1
Substitute=#CommonSubstitute#
[@Alert8Description]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=29
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute=#CommonSubstitute#
DynamicVariables=1
[@Alert8SeverityCode]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=30
Substitute=#CommonSubstitute#
[@Alert8Severity]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=31
Substitute=#CommonSubstitute#
[@Alert8Text]
Measure=WebParser
Url=[@AlertsParent]
StringIndex=32
DecodeCharacterReference=1
Substitute=#CommonSubstitute#
LeftMouseUpAction=[https://weather.com/weather/today/l/#Latitude#,#Longitude#]VClouds wrote: ↑August 2nd, 2020, 10:49 am In my weather skin, when clicking the city name at the top has always opened the city page in the weather.com website.
Using this url: https://weather.com/#Language#/weather/today/l/#LocationCode#
Now after converting to the new Latitude & Longitude method instead of the weather code one, that url obviously does not work anymore.
I know that I can force the user to also enter the location code in addition to the coordinates and that will fix this, but that is something I prefer not to do as it will confuse a lot of my users.
So I wonder if there's some alternative url that uses Latitude & Longitude to open the city page in the weather.com site?
Excellent! Thank you!jsmorley wrote: ↑August 2nd, 2020, 11:29 am LeftMouseUpAction=[https://weather.com/weather/today/l/#Latitude#,#Longitude#]
VClouds wrote: ↑August 2nd, 2020, 10:49 am In my weather skin, when clicking the city name at the top has always opened the city page in the weather.com website.
Using this url: https://weather.com/#Language#/weather/today/l/#LocationCode#
Now after converting to the new Latitude & Longitude method instead of the weather code one, that url obviously does not work anymore.
I know that I can force the user to also enter the location code in addition to the coordinates and that will fix this, but that is something I prefer not to do as it will confuse a lot of my users.
So I wonder if there's some alternative url that uses Latitude & Longitude to open the city page in the weather.com site?
Actually, you can do even better. Didn't mentioned it as the Nominatim variant of finding your latitude and longitude was independent, flexible and didn't require an API key and frankly I didn't try out these URLs until now, but one can do pretty much the same in weather.com:jsmorley wrote: ↑August 2nd, 2020, 11:29 amLeftMouseUpAction=[https://weather.com/weather/today/l/#Latitude#,#Longitude#]
Code: Select all
https://api.weather.com/v3/location/search?query=Fort Hunt&locationType=city&language=en-CA&format=json&apiKey=<ApiKey>
Code: Select all
https://api.weather.com/v3/location/search?query=Fort Hunt, Virginia, United States&locationType=address&language=en-CA&format=json&apiKey=<ApiKey>
Yeah, there are a lot of ways to get the latitude / longitude for a given location.Yincognito wrote: ↑August 2nd, 2020, 12:53 pm Actually, you can do even better. Didn't mentioned it as the Nominatim variant of finding your latitude and longitude was independent, flexible and didn't require an API key and frankly I didn't try out these URLs until now, but one can do pretty much the same in weather.com:or, even more detailed (didn't know jsmorley's home address, so there is more than one result here too, unlike my case which is pretty much unique and outputs a single result):Code: Select all
https://api.weather.com/v3/location/search?query=Fort Hunt&locationType=city&language=en-CA&format=json&apiKey=<ApiKey>
So basically you'll get a JSON with the possible locations, that you can parse and find out the latitude and longitude to use for the main request to the site for the weather JSON.Code: Select all
https://api.weather.com/v3/location/search?query=Fort Hunt, Virginia, United States&locationType=address&language=en-CA&format=json&apiKey=<ApiKey>
Yep, but it just occured to me that I might have misunderstood VClouds' question in the first place...
Indeed.jsmorley wrote: ↑August 2nd, 2020, 12:59 pm Yeah, there are a lot of ways to get the latitude / longitude for a given location.
This is probably my favorite:
https://forum.rainmeter.net/viewtopic.php?f=118&t=34628&start=530#p180890
As then you can have a link like:
https://www.google.com/maps/search/#Latitude#,#Longitude#
in your skin, and it will jump straight to your actual house in Google Maps, confirming that the skin is in fact using the right location.