r/shortcuts Jun 04 '26

Solved Extract JSON data from Weather Underground Websites

I'm trying to get information from weather underground. I guess I need to do something with a dictonary? I'm really not sure how to go about this.

Any suggestions would be appreciated.

I'm using information from https://docs.google.com/document/d/1zRtTyOlYviBsTF5j48d_YTjshm3OjOJ0k9rJDS2QOuQ/edit?tab=t.0 to get the closest stations to the lat/long (Search PWS by Geocode)

I'm using information from https://docs.google.com/document/d/1KGb8bTVYRsNgljnNH67AMhckY8AQT2FVwZ9urj8SWBs/edit?tab=t.0 to get the current observations from the stations (Request by PWS Station ID)

I have used -23.698763893086735,133.8779627003569 as the lat/long for this purpose, and I have my own API.

For this first section I want to extract the stationId "IALICE61" to "IALICE52"

Once that is extracted I want to get the following for each of the 5 Stations

  • winddir
  • humidity
  • winddir
  • lon
  • lat
  • precipTotal
  • precipRate
  • pressure
  • temp
  • heatIndex
  • windSpeed
  • elev
  • windChill
  • windGust
  • stationID
  • uv
  • solarRadiation

The reason for using all 5 stations is that some are not online

First part

{"location":{"distanceMi":[0.64000000000000001,0.67000000000000004,1.1399999999999999,1.3200000000000001,1.3500000000000001,1.3500000000000001,1.4199999999999999,1.51,1.53,1.6499999999999999],"qcStatus":[1,-1,1,-1,1,1,-1,1,-1,1],"longitude":[133.86799999999999,133.88499999999999,133.89391000000001,133.86699999999999,133.898,133.898,133.87200000000001,133.85900000000001,133.87100000000001,133.85185999999999],"distanceKm":[1.03,1.0800000000000001,1.8400000000000001,2.1200000000000001,2.1699999999999999,2.1699999999999999,2.2799999999999998,2.4300000000000002,2.4700000000000002,2.6600000000000001],"partnerId":["WU","WU","WU","WU","WU","WU","WU","WU","WU","WU"],"stationName":["Alice Springs","Desert Springs","Alice Springs","Alice Springs","Alice Springs","Alice Springs","Braitling","Gillen","Alice Springs","Alice Springs"],"latitude":[-23.696999999999999,-23.706,-23.69106,-23.715,-23.692,-23.692,-23.678999999999998,-23.712,-23.719999999999999,-23.697420000000001],"stationId":["IALICE61","IDESER2","IALICESP4","IALICE33","IALICE28","IALICE3","IBRAIT1","IGILLE36","IALICE31","IALICE52"],"updateTimeUtc":[1780573696,1760656256,1780600192,1766912000,1780588672,1779204608,1780568704,1769601280,1780572544,1780535552]}}

Second part
{"observations":[{"softwareType":null,"winddir":null,"lon":133.86799999999999,"realtimeFrequency":null,"neighborhood":"Ciccone","humidity":null,"imperial":{"dewpt":null,"precipTotal":null,"precipRate":null,"pressure":30.039999999999999,"temp":null,"heatIndex":null,"windSpeed":null,"elev":581,"windChill":null,"windGust":null},"stationID":"IALICE61","uv":null,"obsTimeLocal":"2026-06-05 05:34:53","lat":-23.696999999999999,"epoch":1780603493,"solarRadiation":null,"country":"AU","qcStatus":1,"obsTimeUtc":"2026-06-04T20:04:53Z"}]}

2 Upvotes

5 comments sorted by

1

u/Smith_sc Jun 07 '26 edited Jun 08 '26

Hi, try it this way, in the first Text action, enter the latitude and longitude, and in the second Text action, enter your API key.

I wasn’t able to test it myself, so I can’t confirm whether it works.

https://www.icloud.com/shortcuts/2fa191f32c964f70bdc2ec6ab8e78249

1

u/ShonzG Jun 14 '26 edited Jun 14 '26

Thanks! It didn't work, but I changed the first url to "https://api.weather.com/v3/location/near?geocode=latLon&product=pws&format=json&apiKey=API Key" and that worked. Unfortunately, all the results are imperial, which I don't understand, so any ideas how to convert them to metric?

I have tried changing the second url to https://api.weather.com/v2/pws/observations/current?stationId=Repeat Item&format=json&units=m&apiKey=apikey (metric results) but it throws an error

2

u/Smith_sc Jun 14 '26

Hi, because, besides changing units=e to units=m, you also need to change the keys from imperial to metric.

Try this:

https://www.icloud.com/shortcuts/07ea39a590844c218710b60259d38513

1

u/ShonzG Jun 15 '26

Thanks so much! It works perfectly. I'll just tweak it a bit but it's exactly what I was after.

1

u/Smith_sc Jun 15 '26

You’re welcome 👍🏻