mirror of
https://github.com/danbulant/covid
synced 2026-06-20 23:21:16 +00:00
Updater for data
This commit is contained in:
parent
3fa0d89aba
commit
6b417f39c8
1 changed files with 21 additions and 0 deletions
21
data/update.js
Normal file
21
data/update.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
const got = require("got");
|
||||
const cheerio = require("cheerio");
|
||||
|
||||
module.exports = async()=>{
|
||||
var res = got("https://www.worldometers.info/coronavirus/");
|
||||
const $ = cheerio.load(res);
|
||||
var table = $("tbody");
|
||||
var cases = $(".maincounter-number");
|
||||
|
||||
var all = cases[0].text();
|
||||
var death = cases[1].text();
|
||||
var recovered = cases[2].text();
|
||||
|
||||
console.log("[ALL] " + all);
|
||||
console.log("[DEATH] " + death);
|
||||
console.log("[RECOVERED] " + recovered);
|
||||
}
|
||||
|
||||
if(require.main == module){
|
||||
module.exports();
|
||||
}
|
||||
Loading…
Reference in a new issue