wttr.in icon indicating copy to clipboard operation
wttr.in copied to clipboard

Query 24hr dusk/dawn in JSON format

Open alexd2580 opened this issue 3 years ago • 2 comments

I'm building a

  • "sun sets in X minutes / at XX:XX"
  • "it will be dark in y minutes / at YY:YY" status bar entry.

For this i need the advanced astronomy data from v2 I'm using JSON as the format which doesn't have dusk and dawn, just sunset and sunrise. And, those fields are in AM/PM format.

Is there a way to get 24hr dusk and dawn info in JSON format? I haven't found it in the docs yet.

alexd2580 avatar Oct 27 '21 16:10 alexd2580

@alexd2580 Sascha hi! Maybe you could use the one-line output format instead?

$ curl wttr.in/Munich?format="%C+\nFeels+like:+%f+\nActually+is:+%t+\nSunrise:+%S+\nSunset:+%s\n"
Sunny
Feels like: +16°C
Actually is: +16°C
Sunrise: 06:57:44
Sunset: 16:56:08

chubin avatar Oct 31 '21 13:10 chubin

If this is still relevant - technically yes, but no. My conflict here is between:

  1. Using just one json query for all the data that i need: Temp / Sunrise / Sunset / WeatherDesc / WeatherCode and having to parse AM/PM into 24hr format

  2. Using two queries: Astronomical data in 24hr format + Other params via regular JSON I can't use only the custom format query, because the weather-code can't be selected in custom format

alexd2580-sf avatar Aug 29 '22 14:08 alexd2580-sf