commit 9399e8387d9c0239b563791f1facdc0f1ef30e16 Author: gabrielkheisa Date: Tue Feb 28 14:02:42 2023 +0700 first commit diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..2333e62 --- /dev/null +++ b/readme.md @@ -0,0 +1,1204 @@ +

Earthquake map

+

Get 150 earthquake data from BMKG for every 15 minutes

+

Implementation on leaflet: https://maps.gabrielkheisa.xyz/earthquake_map/

+ +

JSON: https://api.dev.gabrielkheisa.xyz/earthquake_id/

+

Example:

+
{
+  "server_update": "28-02-2023 13:40:35",
+   "news": [
+    {
+      "time": "2023/02/28 06:33:06.268",
+       "lat": "-1.70",
+       "lon": "120.25",
+       "mag": "M2.7",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/28 06:17:43.998",
+       "lat": "-0.74",
+       "lon": "125.13",
+       "mag": "M3.6",
+       "dep": "10",
+       "reg": "Southern Molucca Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/28 05:11:50.751",
+       "lat": "-1.48",
+       "lon": "120.01",
+       "mag": "M2.4",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/28 03:22:38.456",
+       "lat": "-9.40",
+       "lon": "113.53",
+       "mag": "M3.7",
+       "dep": "50",
+       "reg": "South of Java, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/28 02:32:12.836",
+       "lat": "-1.58",
+       "lon": "120.18",
+       "mag": "M3.5",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/28 01:45:56.475",
+       "lat": "-1.63",
+       "lon": "120.22",
+       "mag": "M3.2",
+       "dep": "5",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/28 01:40:08.126",
+       "lat": "-3.08",
+       "lon": "122.78",
+       "mag": "M3.3",
+       "dep": "15",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/28 00:15:59.574",
+       "lat": "-1.64",
+       "lon": "120.22",
+       "mag": "M2.5",
+       "dep": "5",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 22:00:41.644",
+       "lat": "-8.63",
+       "lon": "116.86",
+       "mag": "M2.9",
+       "dep": "126",
+       "reg": "Sumbawa Region, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 20:58:25.757",
+       "lat": "-1.61",
+       "lon": "120.19",
+       "mag": "M2.3",
+       "dep": "5",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 19:29:08.848",
+       "lat": "-1.63",
+       "lon": "120.22",
+       "mag": "M2.6",
+       "dep": "5",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 19:04:19.835",
+       "lat": "-0.12",
+       "lon": "122.34",
+       "mag": "M3.3",
+       "dep": "750",
+       "reg": "Minahassa Peninsula, Sulawesi(confirmed)"
+    },
+     {
+      "time": "2023/02/27 19:01:16.935",
+       "lat": "-1.64",
+       "lon": "120.20",
+       "mag": "M2.5",
+       "dep": "5",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 18:10:49.320",
+       "lat": "-1.64",
+       "lon": "120.24",
+       "mag": "M2.7",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 18:04:26.782",
+       "lat": "-1.62",
+       "lon": "120.20",
+       "mag": "M2.7",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 17:00:23.897",
+       "lat": "-1.60",
+       "lon": "120.18",
+       "mag": "M2.8",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 16:56:41.919",
+       "lat": "-7.23",
+       "lon": "107.15",
+       "mag": "M2.5",
+       "dep": "17",
+       "reg": "Java, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 16:31:32.131",
+       "lat": "-6.75",
+       "lon": "129.92",
+       "mag": "M5.0",
+       "dep": "154",
+       "reg": "Banda Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/27 16:19:48.476",
+       "lat": "-1.64",
+       "lon": "120.23",
+       "mag": "M3.0",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 16:03:27.751",
+       "lat": "-1.63",
+       "lon": "120.20",
+       "mag": "M2.6",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 15:58:44.997",
+       "lat": "-8.83",
+       "lon": "111.47",
+       "mag": "M3.0",
+       "dep": "53",
+       "reg": "Java, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 15:47:20.269",
+       "lat": "0.90",
+       "lon": "121.17",
+       "mag": "M2.6",
+       "dep": "50",
+       "reg": "Minahassa Peninsula, Sulawesi(confirmed)"
+    },
+     {
+      "time": "2023/02/27 15:37:59.672",
+       "lat": "-2.34",
+       "lon": "133.84",
+       "mag": "M2.8",
+       "dep": "13",
+       "reg": "West Papua Region, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 15:11:50.264",
+       "lat": "-1.62",
+       "lon": "120.18",
+       "mag": "M3.0",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 15:11:29.078",
+       "lat": "-1.62",
+       "lon": "120.19",
+       "mag": "M2.8",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 14:10:55.303",
+       "lat": "-2.44",
+       "lon": "140.67",
+       "mag": "M2.5",
+       "dep": "10",
+       "reg": "Near North Coast of West Papua(confirmed)"
+    },
+     {
+      "time": "2023/02/27 13:25:38.356",
+       "lat": "-5.62",
+       "lon": "119.50",
+       "mag": "M2.2",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 13:21:39.387",
+       "lat": "0.81",
+       "lon": "122.70",
+       "mag": "M2.5",
+       "dep": "25",
+       "reg": "Minahassa Peninsula, Sulawesi(confirmed)"
+    },
+     {
+      "time": "2023/02/27 12:39:58.065",
+       "lat": "-7.61",
+       "lon": "122.30",
+       "mag": "M3.2",
+       "dep": "28",
+       "reg": "Flores Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/27 12:17:20.477",
+       "lat": "4.77",
+       "lon": "95.70",
+       "mag": "M2.2",
+       "dep": "10",
+       "reg": "Northern Sumatra, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 12:16:46.556",
+       "lat": "-1.62",
+       "lon": "120.20",
+       "mag": "M2.2",
+       "dep": "11",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 12:07:22.798",
+       "lat": "-5.61",
+       "lon": "119.56",
+       "mag": "M2.7",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 11:10:37.447",
+       "lat": "-8.79",
+       "lon": "111.82",
+       "mag": "M2.7",
+       "dep": "36",
+       "reg": "Java, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 10:28:18.164",
+       "lat": "-1.53",
+       "lon": "120.12",
+       "mag": "M2.4",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 10:26:38.708",
+       "lat": "3.08",
+       "lon": "125.58",
+       "mag": "M4.2",
+       "dep": "166",
+       "reg": "Talaud Islands, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 10:16:07.307",
+       "lat": "0.31",
+       "lon": "125.73",
+       "mag": "M3.9",
+       "dep": "11",
+       "reg": "Northern Molucca Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/27 09:59:19.009",
+       "lat": "-1.61",
+       "lon": "120.19",
+       "mag": "M3.5",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 09:50:43.031",
+       "lat": "-11.28",
+       "lon": "166.41",
+       "mag": "M5.7",
+       "dep": "87",
+       "reg": "Santa Cruz Islands(confirmed)"
+    },
+     {
+      "time": "2023/02/27 09:09:15.443",
+       "lat": "-1.62",
+       "lon": "120.22",
+       "mag": "M2.8",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 09:04:56.429",
+       "lat": "38.17",
+       "lon": "38.27",
+       "mag": "M5.5",
+       "dep": "40",
+       "reg": "Turkey(confirmed)"
+    },
+     {
+      "time": "2023/02/27 08:19:33.693",
+       "lat": "-3.74",
+       "lon": "140.33",
+       "mag": "M3.3",
+       "dep": "51",
+       "reg": "West Papua, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 08:17:50.596",
+       "lat": "-1.64",
+       "lon": "120.28",
+       "mag": "M2.9",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 07:40:07.085",
+       "lat": "-1.57",
+       "lon": "120.28",
+       "mag": "M2.7",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 07:36:17.031",
+       "lat": "-1.61",
+       "lon": "120.19",
+       "mag": "M3.2",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 07:29:04.555",
+       "lat": "-1.60",
+       "lon": "120.20",
+       "mag": "M3.5",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 07:22:49.159",
+       "lat": "-1.62",
+       "lon": "120.19",
+       "mag": "M2.6",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 06:47:13.227",
+       "lat": "0.04",
+       "lon": "123.51",
+       "mag": "M3.1",
+       "dep": "143",
+       "reg": "Minahassa Peninsula, Sulawesi(confirmed)"
+    },
+     {
+      "time": "2023/02/27 06:43:36.298",
+       "lat": "-1.60",
+       "lon": "120.19",
+       "mag": "M2.8",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 06:40:58.554",
+       "lat": "-20.51",
+       "lon": "-178.15",
+       "mag": "M5.3",
+       "dep": "544",
+       "reg": "Fiji Islands Region(confirmed)"
+    },
+     {
+      "time": "2023/02/27 05:32:21.032",
+       "lat": "-1.59",
+       "lon": "120.14",
+       "mag": "M2.7",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 05:29:58.848",
+       "lat": "-1.53",
+       "lon": "120.15",
+       "mag": "M3.0",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 05:16:40.514",
+       "lat": "-1.61",
+       "lon": "120.22",
+       "mag": "M2.8",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 05:02:29.461",
+       "lat": "-1.61",
+       "lon": "120.18",
+       "mag": "M2.5",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 04:39:48.066",
+       "lat": "-1.58",
+       "lon": "120.14",
+       "mag": "M2.7",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 04:33:17.066",
+       "lat": "-1.55",
+       "lon": "120.22",
+       "mag": "M4.3",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 04:25:30.750",
+       "lat": "-1.57",
+       "lon": "120.18",
+       "mag": "M2.8",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 03:55:06.306",
+       "lat": "-1.67",
+       "lon": "120.28",
+       "mag": "M2.9",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 03:28:42.266",
+       "lat": "-1.60",
+       "lon": "120.22",
+       "mag": "M2.7",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 02:56:52.188",
+       "lat": "-1.68",
+       "lon": "120.07",
+       "mag": "M2.4",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 02:51:27.973",
+       "lat": "37.79",
+       "lon": "37.75",
+       "mag": "M5.8",
+       "dep": "49",
+       "reg": "Turkey(confirmed)"
+    },
+     {
+      "time": "2023/02/27 02:49:42.097",
+       "lat": "-1.46",
+       "lon": "120.00",
+       "mag": "M2.4",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 02:34:33.612",
+       "lat": "-1.69",
+       "lon": "120.14",
+       "mag": "M2.9",
+       "dep": "49",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 02:33:13.315",
+       "lat": "4.75",
+       "lon": "95.82",
+       "mag": "M1.9",
+       "dep": "95",
+       "reg": "Northern Sumatra, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 02:31:54.249",
+       "lat": "-1.19",
+       "lon": "120.13",
+       "mag": "M2.3",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 02:27:48.671",
+       "lat": "-1.57",
+       "lon": "120.04",
+       "mag": "M2.5",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 02:21:08.346",
+       "lat": "-1.60",
+       "lon": "120.22",
+       "mag": "M3.1",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 02:14:17.797",
+       "lat": "-1.62",
+       "lon": "120.22",
+       "mag": "M2.6",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 02:00:11.657",
+       "lat": "-1.63",
+       "lon": "120.30",
+       "mag": "M3.2",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 01:48:46.837",
+       "lat": "-1.57",
+       "lon": "120.21",
+       "mag": "M4.5",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 01:46:28.185",
+       "lat": "-1.64",
+       "lon": "120.19",
+       "mag": "M2.8",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 01:43:21.904",
+       "lat": "-1.60",
+       "lon": "120.16",
+       "mag": "M3.3",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 01:37:41.135",
+       "lat": "-1.62",
+       "lon": "120.21",
+       "mag": "M3.4",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 01:35:51.351",
+       "lat": "-1.66",
+       "lon": "120.23",
+       "mag": "M3.2",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 01:26:03.905",
+       "lat": "-1.58",
+       "lon": "120.25",
+       "mag": "M5.5",
+       "dep": "10",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/27 01:19:27.125",
+       "lat": "2.97",
+       "lon": "125.64",
+       "mag": "M3.8",
+       "dep": "101",
+       "reg": "Talaud Islands, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/26 23:58:10.235",
+       "lat": "41.70",
+       "lon": "79.83",
+       "mag": "M5.3",
+       "dep": "41",
+       "reg": "Kyrgyzstan-Xinjiang Border Region(confirmed)"
+    },
+     {
+      "time": "2023/02/26 23:33:21.794",
+       "lat": "18.82",
+       "lon": "145.62",
+       "mag": "M5.3",
+       "dep": "239",
+       "reg": "Mariana Islands(confirmed)"
+    },
+     {
+      "time": "2023/02/26 21:42:21.657",
+       "lat": "41.95",
+       "lon": "79.86",
+       "mag": "M5.0",
+       "dep": "71",
+       "reg": "Kyrgyzstan-Xinjiang Border Region(confirmed)"
+    },
+     {
+      "time": "2023/02/26 21:27:17.313",
+       "lat": "-7.51",
+       "lon": "106.73",
+       "mag": "M2.4",
+       "dep": "52",
+       "reg": "Java, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/26 21:15:26.134",
+       "lat": "-9.23",
+       "lon": "123.09",
+       "mag": "M3.8",
+       "dep": "60",
+       "reg": "Timor Region(confirmed)"
+    },
+     {
+      "time": "2023/02/26 20:51:39.666",
+       "lat": "-6.56",
+       "lon": "104.23",
+       "mag": "M3.3",
+       "dep": "10",
+       "reg": "Sunda Strait, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/26 20:38:12.249",
+       "lat": "-2.89",
+       "lon": "127.62",
+       "mag": "M2.8",
+       "dep": "26",
+       "reg": "Ceram Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/26 17:32:24.370",
+       "lat": "-3.47",
+       "lon": "100.59",
+       "mag": "M3.5",
+       "dep": "23",
+       "reg": "Southern Sumatra, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/26 16:41:16.198",
+       "lat": "-8.67",
+       "lon": "123.35",
+       "mag": "M4.7",
+       "dep": "177",
+       "reg": "Flores Region, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/26 11:44:24.321",
+       "lat": "-9.36",
+       "lon": "115.95",
+       "mag": "M3.7",
+       "dep": "31",
+       "reg": "South of Bali, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/26 09:32:07.109",
+       "lat": "1.59",
+       "lon": "120.46",
+       "mag": "M3.4",
+       "dep": "25",
+       "reg": "Minahassa Peninsula, Sulawesi(confirmed)"
+    },
+     {
+      "time": "2023/02/26 09:14:49.040",
+       "lat": "19.24",
+       "lon": "121.18",
+       "mag": "M4.8",
+       "dep": "42",
+       "reg": "Philippine Islands Region(confirmed)"
+    },
+     {
+      "time": "2023/02/26 08:34:32.003",
+       "lat": "1.45",
+       "lon": "122.90",
+       "mag": "M4.7",
+       "dep": "10",
+       "reg": "Minahassa Peninsula, Sulawesi(confirmed)"
+    },
+     {
+      "time": "2023/02/26 06:14:45.467",
+       "lat": "1.70",
+       "lon": "125.84",
+       "mag": "M3.2",
+       "dep": "12",
+       "reg": "Northern Molucca Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/26 06:04:03.805",
+       "lat": "-0.22",
+       "lon": "124.71",
+       "mag": "M3.3",
+       "dep": "11",
+       "reg": "Southern Molucca Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/26 05:52:50.936",
+       "lat": "1.72",
+       "lon": "125.88",
+       "mag": "M4.8",
+       "dep": "38",
+       "reg": "Northern Molucca Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/26 05:49:33.000",
+       "lat": "1.40",
+       "lon": "128.93",
+       "mag": "M3.6",
+       "dep": "10",
+       "reg": "Halmahera, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/26 03:53:04.788",
+       "lat": "5.67",
+       "lon": "126.50",
+       "mag": "M4.7",
+       "dep": "10",
+       "reg": "Mindanao, Philippines(confirmed)"
+    },
+     {
+      "time": "2023/02/25 23:32:50.475",
+       "lat": "-0.28",
+       "lon": "124.55",
+       "mag": "M4.7",
+       "dep": "10",
+       "reg": "Southern Molucca Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/25 22:36:55.794",
+       "lat": "-7.75",
+       "lon": "118.91",
+       "mag": "M2.9",
+       "dep": "10",
+       "reg": "Flores Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/25 22:13:16.678",
+       "lat": "1.43",
+       "lon": "126.35",
+       "mag": "M3.7",
+       "dep": "10",
+       "reg": "Northern Molucca Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/25 22:12:33.924",
+       "lat": "3.64",
+       "lon": "97.15",
+       "mag": "M2.7",
+       "dep": "41",
+       "reg": "Northern Sumatra, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 21:43:15.494",
+       "lat": "1.00",
+       "lon": "98.41",
+       "mag": "M4.2",
+       "dep": "18",
+       "reg": "Northern Sumatra, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 21:24:56.629",
+       "lat": "-6.26",
+       "lon": "149.97",
+       "mag": "M6.2",
+       "dep": "121",
+       "reg": "New Britain Region, Papua New Guinea(confirmed)"
+    },
+     {
+      "time": "2023/02/25 21:21:46.929",
+       "lat": "-9.79",
+       "lon": "119.71",
+       "mag": "M3.3",
+       "dep": "25",
+       "reg": "Sumba Region, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 20:21:52.019",
+       "lat": "-8.49",
+       "lon": "118.61",
+       "mag": "M3.6",
+       "dep": "121",
+       "reg": "Sumbawa Region, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 19:10:35.200",
+       "lat": "-2.94",
+       "lon": "128.92",
+       "mag": "M2.5",
+       "dep": "10",
+       "reg": "Ceram Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/25 17:39:11.021",
+       "lat": "2.03",
+       "lon": "126.67",
+       "mag": "M3.3",
+       "dep": "11",
+       "reg": "Northern Molucca Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/25 17:09:58.934",
+       "lat": "-7.80",
+       "lon": "118.60",
+       "mag": "M3.1",
+       "dep": "31",
+       "reg": "Flores Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/25 16:48:10.118",
+       "lat": "-12.00",
+       "lon": "122.51",
+       "mag": "M4.6",
+       "dep": "27",
+       "reg": "South of Timor, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 16:13:01.134",
+       "lat": "-2.41",
+       "lon": "140.48",
+       "mag": "M2.6",
+       "dep": "10",
+       "reg": "Near North Coast of West Papua(confirmed)"
+    },
+     {
+      "time": "2023/02/25 16:03:18.944",
+       "lat": "22.60",
+       "lon": "121.46",
+       "mag": "M4.6",
+       "dep": "10",
+       "reg": "Taiwan Region(confirmed)"
+    },
+     {
+      "time": "2023/02/25 15:51:16.703",
+       "lat": "-0.74",
+       "lon": "121.99",
+       "mag": "M3.4",
+       "dep": "10",
+       "reg": "Minahassa Peninsula, Sulawesi(confirmed)"
+    },
+     {
+      "time": "2023/02/25 15:23:55.494",
+       "lat": "0.78",
+       "lon": "98.68",
+       "mag": "M3.6",
+       "dep": "38",
+       "reg": "Northern Sumatra, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 14:37:41.751",
+       "lat": "0.57",
+       "lon": "120.63",
+       "mag": "M2.8",
+       "dep": "72",
+       "reg": "Minahassa Peninsula, Sulawesi(confirmed)"
+    },
+     {
+      "time": "2023/02/25 14:26:14.788",
+       "lat": "-3.81",
+       "lon": "137.06",
+       "mag": "M3.5",
+       "dep": "135",
+       "reg": "West Papua, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 14:23:58.395",
+       "lat": "-8.58",
+       "lon": "117.70",
+       "mag": "M1.9",
+       "dep": "124",
+       "reg": "Sumbawa Region, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 13:58:15.760",
+       "lat": "-2.69",
+       "lon": "129.65",
+       "mag": "M3.5",
+       "dep": "10",
+       "reg": "Seram, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 13:27:38.379",
+       "lat": "42.96",
+       "lon": "145.12",
+       "mag": "M6.0",
+       "dep": "10",
+       "reg": "Hokkaido, Japan Region(confirmed)"
+    },
+     {
+      "time": "2023/02/25 13:26:14.655",
+       "lat": "-9.08",
+       "lon": "118.85",
+       "mag": "M3.5",
+       "dep": "10",
+       "reg": "Sumbawa Region, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 13:06:22.976",
+       "lat": "-0.72",
+       "lon": "122.04",
+       "mag": "M3.3",
+       "dep": "10",
+       "reg": "Minahassa Peninsula, Sulawesi(confirmed)"
+    },
+     {
+      "time": "2023/02/25 11:56:51.954",
+       "lat": "-2.85",
+       "lon": "141.29",
+       "mag": "M2.9",
+       "dep": "10",
+       "reg": "Near North Coast of Papua New Guinea(confirmed)"
+    },
+     {
+      "time": "2023/02/25 10:54:10.343",
+       "lat": "-7.43",
+       "lon": "129.03",
+       "mag": "M4.8",
+       "dep": "77",
+       "reg": "Banda Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/25 10:27:11.915",
+       "lat": "38.14",
+       "lon": "34.28",
+       "mag": "M5.5",
+       "dep": "10",
+       "reg": "Turkey(confirmed)"
+    },
+     {
+      "time": "2023/02/25 10:25:42.794",
+       "lat": "27.25",
+       "lon": "127.09",
+       "mag": "M5.3",
+       "dep": "10",
+       "reg": "Ryukyu Islands, Japan(confirmed)"
+    },
+     {
+      "time": "2023/02/25 09:07:00.849",
+       "lat": "-1.32",
+       "lon": "101.73",
+       "mag": "M3.1",
+       "dep": "166",
+       "reg": "Southern Sumatra, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 07:17:59.384",
+       "lat": "1.54",
+       "lon": "128.55",
+       "mag": "M4.0",
+       "dep": "23",
+       "reg": "Halmahera, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 06:25:23.695",
+       "lat": "51.80",
+       "lon": "158.46",
+       "mag": "M5.2",
+       "dep": "75",
+       "reg": "Near East Coast of Kamchatka(confirmed)"
+    },
+     {
+      "time": "2023/02/25 05:28:12.546",
+       "lat": "3.51",
+       "lon": "127.51",
+       "mag": "M3.6",
+       "dep": "10",
+       "reg": "Talaud Islands, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 05:26:29.244",
+       "lat": "3.22",
+       "lon": "127.17",
+       "mag": "M3.6",
+       "dep": "10",
+       "reg": "Talaud Islands, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 05:16:36.289",
+       "lat": "-9.59",
+       "lon": "116.50",
+       "mag": "M3.2",
+       "dep": "33",
+       "reg": "Sumbawa Region, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 04:55:47.529",
+       "lat": "-5.02",
+       "lon": "131.49",
+       "mag": "M3.7",
+       "dep": "119",
+       "reg": "Banda Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/25 04:21:19.535",
+       "lat": "-1.64",
+       "lon": "100.25",
+       "mag": "M3.0",
+       "dep": "21",
+       "reg": "Southern Sumatra, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 03:08:02.164",
+       "lat": "-5.53",
+       "lon": "103.16",
+       "mag": "M3.9",
+       "dep": "10",
+       "reg": "Southern Sumatra, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 02:21:52.271",
+       "lat": "-2.49",
+       "lon": "140.67",
+       "mag": "M3.1",
+       "dep": "10",
+       "reg": "Near North Coast of West Papua(confirmed)"
+    },
+     {
+      "time": "2023/02/25 02:08:31.143",
+       "lat": "-5.73",
+       "lon": "103.87",
+       "mag": "M4.5",
+       "dep": "25",
+       "reg": "Southern Sumatra, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/25 01:59:54.326",
+       "lat": "-6.42",
+       "lon": "130.31",
+       "mag": "M4.0",
+       "dep": "63",
+       "reg": "Banda Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/24 17:28:36.836",
+       "lat": "2.88",
+       "lon": "126.19",
+       "mag": "M4.8",
+       "dep": "10",
+       "reg": "Northern Molucca Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/24 16:16:35.709",
+       "lat": "2.32",
+       "lon": "126.71",
+       "mag": "M3.3",
+       "dep": "65",
+       "reg": "Northern Molucca Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/24 16:02:29.109",
+       "lat": "4.31",
+       "lon": "126.64",
+       "mag": "M3.4",
+       "dep": "22",
+       "reg": "Talaud Islands, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/24 15:24:47.220",
+       "lat": "14.12",
+       "lon": "146.90",
+       "mag": "M5.0",
+       "dep": "10",
+       "reg": "Mariana Islands(confirmed)"
+    },
+     {
+      "time": "2023/02/24 14:43:34.335",
+       "lat": "-3.57",
+       "lon": "100.89",
+       "mag": "M3.3",
+       "dep": "10",
+       "reg": "Southern Sumatra, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/24 13:59:53.729",
+       "lat": "-8.24",
+       "lon": "124.57",
+       "mag": "M3.2",
+       "dep": "10",
+       "reg": "Timor Region(confirmed)"
+    },
+     {
+      "time": "2023/02/24 09:52:12.654",
+       "lat": "-1.83",
+       "lon": "137.90",
+       "mag": "M3.4",
+       "dep": "46",
+       "reg": "Near North Coast of West Papua(confirmed)"
+    },
+     {
+      "time": "2023/02/24 09:43:54.129",
+       "lat": "-2.53",
+       "lon": "140.70",
+       "mag": "M2.0",
+       "dep": "54",
+       "reg": "Near North Coast of West Papua(confirmed)"
+    },
+     {
+      "time": "2023/02/24 09:28:56.255",
+       "lat": "-2.52",
+       "lon": "140.70",
+       "mag": "M3.0",
+       "dep": "10",
+       "reg": "Near North Coast of West Papua(confirmed)"
+    },
+     {
+      "time": "2023/02/24 09:02:54.282",
+       "lat": "3.65",
+       "lon": "128.74",
+       "mag": "M4.5",
+       "dep": "10",
+       "reg": "North of Halmahera, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/24 07:52:43.964",
+       "lat": "0.35",
+       "lon": "121.89",
+       "mag": "M2.5",
+       "dep": "175",
+       "reg": "Minahassa Peninsula, Sulawesi(confirmed)"
+    },
+     {
+      "time": "2023/02/24 07:15:32.058",
+       "lat": "-2.66",
+       "lon": "120.92",
+       "mag": "M1.9",
+       "dep": "11",
+       "reg": "Sulawesi, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/24 07:13:12.905",
+       "lat": "-9.55",
+       "lon": "111.44",
+       "mag": "M3.3",
+       "dep": "10",
+       "reg": "South of Java, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/24 05:54:31.670",
+       "lat": "-8.57",
+       "lon": "122.02",
+       "mag": "M2.2",
+       "dep": "19",
+       "reg": "Flores Region, Indonesia(confirmed)"
+    },
+     {
+      "time": "2023/02/24 05:46:44.127",
+       "lat": "-2.47",
+       "lon": "140.73",
+       "mag": "M2.5",
+       "dep": "10",
+       "reg": "Near North Coast of West Papua(confirmed)"
+    },
+     {
+      "time": "2023/02/24 05:27:27.865",
+       "lat": "-2.90",
+       "lon": "127.47",
+       "mag": "M2.8",
+       "dep": "52",
+       "reg": "Ceram Sea(confirmed)"
+    },
+     {
+      "time": "2023/02/24 05:24:56.314",
+       "lat": "-5.06",
+       "lon": "155.16",
+       "mag": "M5.0",
+       "dep": "155",
+       "reg": "Solomon Islands(confirmed)"
+    }
+  ]
+}
+ diff --git a/script.py b/script.py new file mode 100644 index 0000000..ae69a07 --- /dev/null +++ b/script.py @@ -0,0 +1,101 @@ +import requests +from selenium import webdriver +from selenium.webdriver.chrome.options import Options +import time +from datetime import datetime +import base64 +import json +import urllib.parse + +from selenium.webdriver.chrome.options import Options + +key = "API_KEY" + +while(1): + try: + now = datetime.now() + dt_string = now.strftime("%d-%m-%Y %H:%M:%S") + + # To bypass CloudFlare's detection + user_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.50 Safari/537.36' + + + options = Options() + options.add_argument('--headless') + options.add_argument('--disable-gpu') + options.add_argument('--window-size=1920,1080') + options.add_argument('--no-sandbox') + + # To bypass CloudFlare's detection + # options.add_argument('--disable-blink-features=AutomationControlled') + options.add_argument(f'user-agent={user_agent}') + + browser = webdriver.Chrome(executable_path="/usr/bin/chromedriver", chrome_options=options) + + ''' + if the popup appear, use this xpath + /html/body/div[1]/div[3]/div/div[1]/div/div[2]/table/tbody/tr[1]/td[2] + else, use the original one + /html/body/div[1]/div[3]/div/div[1]/div/div/table/tbody/tr[1]/td[2] + ''' + + + browser.delete_all_cookies() + browser.get("https://www.bmkg.go.id/gempabumi/gempabumi-realtime.bmkg") + + browser.implicitly_wait(10) + + browser.save_screenshot('screen_shot_gempa.png') + + + + #Quick copy + #browser.find_element_by_xpath("").get_attribute('') + + news = { + "server_update": dt_string, + "news": [ + { + "time": browser.find_element_by_xpath("/html/body/div[1]/div[3]/div/div[1]/div/div[2]/table/tbody/tr[1]/td[2]").get_attribute('textContent'), + "lat": browser.find_element_by_xpath("/html/body/div[1]/div[3]/div/div[1]/div/div[2]/table/tbody/tr[1]/td[3]").get_attribute('textContent'), + "lon": browser.find_element_by_xpath("/html/body/div[1]/div[3]/div/div[1]/div/div[2]/table/tbody/tr[1]/td[4]").get_attribute('textContent'), + "mag": browser.find_element_by_xpath("/html/body/div[1]/div[3]/div/div[1]/div/div[2]/table/tbody/tr[1]/td[5]").get_attribute('textContent'), + "dep": browser.find_element_by_xpath("/html/body/div[1]/div[3]/div/div[1]/div/div[2]/table/tbody/tr[1]/td[6]").get_attribute('textContent'), + "reg": browser.find_element_by_xpath("/html/body/div[1]/div[3]/div/div[1]/div/div[2]/table/tbody/tr[1]/td[7]").get_attribute('textContent') + } + ] + } + + i = 2 + + while(i<150): + news["news"].append( + { + "time": browser.find_element_by_xpath("/html/body/div[1]/div[3]/div/div[1]/div/div[2]/table/tbody/tr["+str(i)+"]/td[2]").get_attribute('textContent'), + "lat": browser.find_element_by_xpath("/html/body/div[1]/div[3]/div/div[1]/div/div[2]/table/tbody/tr["+str(i)+"]/td[3]").get_attribute('textContent'), + "lon": browser.find_element_by_xpath("/html/body/div[1]/div[3]/div/div[1]/div/div[2]/table/tbody/tr["+str(i)+"]/td[4]").get_attribute('textContent'), + "mag": browser.find_element_by_xpath("/html/body/div[1]/div[3]/div/div[1]/div/div[2]/table/tbody/tr["+str(i)+"]/td[5]").get_attribute('textContent'), + "dep": browser.find_element_by_xpath("/html/body/div[1]/div[3]/div/div[1]/div/div[2]/table/tbody/tr["+str(i)+"]/td[6]").get_attribute('textContent'), + "reg": browser.find_element_by_xpath("/html/body/div[1]/div[3]/div/div[1]/div/div[2]/table/tbody/tr["+str(i)+"]/td[7]").get_attribute('textContent') + } + ) + + i = i + 1 + + #news = json.dumps(news) + + with open('data_earthquake.json', 'w') as f: + json.dump(news, f) + + !cp data_earthquake.json /var/www/api.dev.gabrielkheisa.xyz/earthquake_id/cache.txt + + browser.quit() + print("Sleep for 15 minutes") + time.sleep(15*60) + + except Exception as e: + print(e) + browser.quit() + print("Sleep for 15 minutes") + time.sleep(15*60) +