From 91e847126c832efa25ab0bf8d6f3b7e537378fa7 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 16 Jan 2023 23:40:25 -0800 Subject: shuffle things around --- lib/locations.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lib/locations.js (limited to 'lib/locations.js') diff --git a/lib/locations.js b/lib/locations.js new file mode 100644 index 00000000..bd2cfb5e --- /dev/null +++ b/lib/locations.js @@ -0,0 +1,20 @@ +import got from "got"; +import { s } from "$lib/db"; + +export let getLocations = async () => { + try { + let locations = await got( + "https://api.btcmap.org/v2/elements?updated_since=2022-09-19" + ).json(); + + locations = locations.filter( + l => + l["osm_json"].tags && l["osm_json"].tags["payment:coinos"] === "yes" + ) + + + await s("locations", locations); + } catch (e) {} + + setTimeout(getLocations, 60000); +}; -- cgit v1.2.3