1.0.306 • Published 11 months ago

bmkg-scraper v1.0.306

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

welcom to bmkg-scraper

how to install

npm install bmkg-scraper

how to use it

import { BMKGEarthquake, BMKGWeather, BMKGAreaID } from "bmkg-scraper";

(async function () {
  try { 
    const weather = new BMKGWeather();
    const ponorogo = BMKGAreaID.jawaTimur.kabPonorogo.ponorogo;

    const ponorogoWheather = await weather.jawaTimur(ponorogo);
    console.log(ponorogoWheather);

    const earthquake = new BMKGEarthquake();
    const listEarthquake = await earthquake.list();
    console.log(listEarthquake);
  } catch(e) {
    console.log("error", e);
  }
})();

another way how to use :

import { BMKGEarthquake, BMKGWeather, BMKGAreaID } from "bmkg-scraper";

async function getWeather(prov, kab, kec) {
  try { 
    let weather = new BMKGWeather();
    let queries = BMKGAreaID[prov][kab][kec];
    let data = await weather[prov](queries);
    console.log(data);

  } catch(e) {
    console.log("error", e);
  }
};

async function getEarthquake() {
 try {
   const earthquake = new BMKGEarthquake();
    const listEarthquake = await earthquake.list();
    console.log(listEarthquake);
  } catch(e) {
    console.log("error", e);
  }
}

let prov = 'jawaTimur';
let kab = 'kabPonorogo';
let kec = 'ponorogo';

getWeather(prov, kab, kec); 
getEarthquake();

for more information about BMKGAreaID see areaid

info

this package is under development more features in the future

note

this only work on nodejs 18+

1.0.305

11 months ago

1.0.306

11 months ago

1.0.303

11 months ago

1.0.2

11 months ago

1.0.202

11 months ago

1.0.201

11 months ago

1.0.302

11 months ago

1.0.0

12 months ago