Sunrise & Sunset Scraper: Solar Times by Coordinate avatar

Sunrise & Sunset Scraper: Solar Times by Coordinate

Pricing

from $0.37 / 1,000 time scrapeds

Go to Apify Store
Sunrise & Sunset Scraper: Solar Times by Coordinate

Sunrise & Sunset Scraper: Solar Times by Coordinate

Calculate sunrise, sunset, solar noon, civil/nautical/astronomical twilight and day length for any coordinate and date. No login, no proxy, no browser.

Pricing

from $0.37 / 1,000 time scrapeds

Rating

0.0

(0)

Developer

Arman Hossain

Arman Hossain

Maintained by Community

Actor stats

0

Bookmarked

1

Total users

0

Monthly active users

18 days ago

Last modified

Share

Sunrise & Sunset Scraper: Sunrise, sunset, solar noon, day length and civil/nautical/astronomical twilight for any coordinate and date

Sunrise & Sunset Scraper computes sunrise, sunset, solar noon, day length and all three twilight bands, civil, nautical and astronomical, for any coordinate on Earth and any date.

It reads the public Sunrise-Sunset API directly: no proxy setup, no browser, no credentials to manage. A year of golden-hour times for one city is a run measured in seconds.

Agent skill: SKILL.md

https://api.apify.com/v2/key-value-stores/t7YoTxpZEJOWvw4Ug/records/sunrise-sunset-scraper.md

What you get

Output fieldMeaning
locationYour own label if you gave one, otherwise the canonical lat,lon string
latitude, longitudeParsed and range-validated coordinates
dateThe day computed, YYYY-MM-DD
sunrise, sunsetISO 8601 timestamps in your chosen timezone
solarNoonMoment the sun is highest
dayLengthSeconds between sunrise and sunset
civilTwilightBegin, civilTwilightEndDawn and dusk, sun 6° below the horizon
nauticalTwilightBegin, nauticalTwilightEndSun 12° below the horizon
astronomicalTwilightBegin, astronomicalTwilightEndSun 18° below the horizon, full darkness
scrapedAtRun timestamp

A RUN_SUMMARY record in the key-value store holds per-run counts, the settings used, and any location-date that failed.

Common use cases

  • Photography and film scheduling. Plan shoots around golden hour and blue hour across a whole location scout list.
  • Lighting and energy automation. Drive smart-home or building schedules off real sunset times instead of fixed clocks.
  • Agriculture and field work. Compute usable daylight per site, per day, across a season.
  • Astronomy planning. Astronomical twilight tells you when the sky is actually dark.
  • AI agents and enrichment pipelines. A cheap, deterministic daylight layer for any coordinate you already hold.

Quick start

Two cities, today:

{
"locations": ["Malaga: 36.72,-4.42", "Reykjavik: 64.15,-21.94"]
}

A week of golden hour in local time:

{
"locations": ["Malaga: 36.72,-4.42"],
"dates": ["2026-08-01.2026-08-07"],
"timezone": "Europe/Madrid"
}

Solstice comparison across a shortlist, capped:

{
"locations": [
"Quito: -0.18,-78.47",
"London: 51.51,-0.13",
"Tromso: 69.65,18.96"
],
"dates": ["2026-06-21", "2026-12-21"],
"timezone": "UTC",
"maxResults": 100
}

Input

FieldTypeDefaultNotes
locationsarray-Required. lat,lon strings. Prefix with Name: to label the output. Google Maps URLs and { name, lat, lng } objects are accepted too.
datesarray[today]YYYY-MM-DD, the keywords today / tomorrow / yesterday, or an inclusive range 2026-08-01.2026-08-07.
timezonestringUTCIANA name, e.g. Europe/Madrid. Applies to every returned timestamp.
maxResultsinteger0Cap on total records. 0 = no limit.

locations and dates multiply out: 10 locations × 365 dates is 3,650 records and 3,650 requests. Use maxResults when experimenting.

Output example

{
"location": "Malaga",
"latitude": 36.72,
"longitude": -4.42,
"date": "2026-08-06",
"sunrise": "2026-08-06T07:26:18+02:00",
"sunset": "2026-08-06T21:20:52+02:00",
"solarNoon": "2026-08-06T14:23:35+02:00",
"dayLength": 50074,
"civilTwilightBegin": "2026-08-06T06:59:33+02:00",
"civilTwilightEnd": "2026-08-06T21:47:37+02:00",
"nauticalTwilightBegin": "2026-08-06T06:25:25+02:00",
"nauticalTwilightEnd": "2026-08-06T22:21:46+02:00",
"astronomicalTwilightBegin": "2026-08-06T05:48:56+02:00",
"astronomicalTwilightEnd": "2026-08-06T22:58:14+02:00",
"scrapedAt": "2026-08-06T12:00:00.000Z"
}

dayLength is in seconds, 50,074 s is 13 h 54 m 34 s.

API example

curl -X POST "https://api.apify.com/v2/acts/arman-bd~sunrise-sunset-scraper/run-sync-get-dataset-items?token=YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"locations": ["Malaga: 36.72,-4.42"],
"dates": ["2026-08-01.2026-08-07"],
"timezone": "Europe/Madrid"
}'

JavaScript example

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_TOKEN' });
const run = await client.actor('arman-bd/sunrise-sunset-scraper').call({
locations: ['Malaga: 36.72,-4.42', 'Reykjavik: 64.15,-21.94'],
dates: ['2026-08-01.2026-08-07'],
timezone: 'UTC',
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
for (const d of items) console.log(`${d.location} ${d.date}: sunset ${d.sunset}`);

Notes

  • Polar day and polar night return null, not 1970. Above the Arctic and below the Antarctic Circle the source reports a Unix-epoch sentinel (1970-01-01T00:00:00+00:00) where a sunrise would be. That silently breaks sorting and date arithmetic, so this Actor converts it to null. When dayLength is 0 and sunrise is null, the sun did not rise or did not set that day.
  • Coordinates are validated here, not at the source. The API answers lat=999 with HTTP 200 and meaningless times. Out-of-range and unparseable entries are dropped before any request is made and listed in RUN_SUMMARY.locationsRejected.
  • One bad location-date doesn't kill the run. Failures are recorded in RUN_SUMMARY.failures; the Actor only errors out if every pair failed.
  • Transient errors are retried. 429, 5xx and network errors get four attempts with exponential backoff (0.5 s → 1 s → 2 s). Malformed requests fail immediately rather than burning retries.
  • Public data only. No authentication, no personal data, no access-control bypass.

FAQ

Do I need a proxy? No. Proxy configuration is not required to run this Actor.

Do I need an account on the source? No, and there is no credentials to manage.

What happens if the source is unavailable? The affected location-date is reported in RUN_SUMMARY.failures and the run continues with the rest.

Can I schedule it? Yes, it is designed for scheduled runs. A nightly run over your location list keeps a rolling daylight table warm.

Why is dayLength a number instead of 13:54:34? Seconds sort and subtract correctly in every tool. Divide by 3600 for hours.

Is sunset the same as golden hour? Golden hour is roughly the hour before sunset and after sunrise; blue hour sits between sunset and civilTwilightEnd. Both are derivable from the fields returned.

Does the timezone affect the calculation? No, only the formatting. Solar times are computed from the coordinate; timezone decides which UTC offset they are printed in.

Can I integrate it with something else? Yes, Apify API, client libraries, webhooks, scheduled runs, dataset exports (JSON/CSV/Excel) or MCP. Output is structured JSON.