[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Sunrise and Sunset from terminal



Hello,

On Sat, Sep 23, 2023 at 07:04:17PM -0400, Greg Wooledge wrote:
> So, what to do instead?  I would first look for a data source that's
> not intended to be displayed by a Javascript-enabled web browser.
> Something that gives you the results in plain text would be great.
> I doubt such a thing can be found easily.  Something that gives the
> results in, say, JSON or XML format might be easier to find.

Here's one:

$ curl -s 'https://api.sunrise-sunset.org/json?lat=51.509865&lng=-0.118092&formatted=0' | jq .
{
  "results": {
    "sunrise": "2023-09-24T05:47:54+00:00",
    "sunset": "2023-09-24T17:57:14+00:00",
    "solar_noon": "2023-09-24T11:52:34+00:00",
    "day_length": 43760,
    "civil_twilight_begin": "2023-09-24T05:16:19+00:00",
    "civil_twilight_end": "2023-09-24T18:28:49+00:00",
    "nautical_twilight_begin": "2023-09-24T04:37:02+00:00",
    "nautical_twilight_end": "2023-09-24T19:08:06+00:00",
    "astronomical_twilight_begin": "2023-09-24T03:56:14+00:00",
    "astronomical_twilight_end": "2023-09-24T19:48:54+00:00"
  },
  "status": "OK"
}

The documentation is here:

    https://sunrise-sunset.org/api

Cheers,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting


Reply to: