Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

bmkg-scraper

ka-shifuka12MITdeprecated1.0.306

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

BMKG Scraper mengambil data dari bmkg dengan mudah

BMKG, Scraper, cuaca, gempa

readme

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+