arrdata = {
//to ensure if we grab the right table, the table must contain either Confirmed, Recovered, or other case
//const targeturl = "https://en.wikipedia.org/wiki/COVID-19_pandemic_in_Indonesia"
//const indicator = 'Official website' //this indicator may changed thus we have to observe it should that occurs
//const result = await scrap(targeturl,`table:contains('${indicator}')`)
const data = result.sel//this is the table containing tbody etc.
var status = '' //status maybe either success or fail
data.length>1?status='fail':status='success';
const datarow = data.find('tr')//get the row data from table.
var db = new a()//preparing for data container in the form of 2D array
var trth = []
var trtd = []
datarow.each((i,e)=>{
//debugger;
//let $ = cheerio.load(e)
let th = null
let td = null
//check for th existence 1st
th = cheerio('th',e)
td = cheerio('td',e)
let trm = td.add(th)
//debugger
loopcol(trm,datarow,db,i)
//debugger
})
let ParseDate = dt.utcParse("%d %B %Y")
-
mutable DateAsOf = data.find("i:contains('Data as of')").contents().text().slice(11)
mutable datestamp = ParseDate(DateAsOf)
mutable timestamp = EpochTime(datestamp)*1000
+
let DateAsOf = data.find("i:contains('Data as of')").contents().text().slice(11)
let datestamp = ParseDate(DateAsOf)
let timestamp = EpochTime(datestamp)*1000
let row = darr.slice(3,38)
let head = darr.slice(2,3)
head[0].unshift('TimeSpan','Tanggal')
row.map(e=>{
//debugger
e.unshift(timestamp,datestamp)
})
return head.concat(row)
//return db
}