Last active
March 11, 2020 22:18
-
-
Save TimeBandit/34a7d372269dad06938494eabb8ad373 to your computer and use it in GitHub Desktop.
get cv19 tabular data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
infectionCount = []; | |
timeString = document.querySelector('.govspeak > p:nth-child(4)').innerText.split(' on ')[1].slice(0, -1).replace(/(\r\n|\n|\r)/gm,""); | |
isoTimeString = new Date(timeString).toISOString(); | |
document.querySelectorAll('tbody > tr').forEach((row) => { | |
let [authority, numberOfCases] = row.cells; | |
infectionCount.push({ | |
authority: authority.innerText, | |
numberOfCases: numberOfCases.innerText | |
}) | |
}) | |
const rows = infectionCount.map((row) => `${row.authority};${row.numberOfCases}`).join('\n') | |
console.log(`;${isoTimeString}\n${rows}`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment