Skip to content

Instantly share code, notes, and snippets.

@dalmo3
Created March 22, 2020 05:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dalmo3/77049f6b74b267e6735482cbb11b46ca to your computer and use it in GitHub Desktop.
Save dalmo3/77049f6b74b267e6735482cbb11b46ca to your computer and use it in GitHub Desktop.
let arr = []
document.querySelectorAll('table.table-style-two tbody tr').forEach(row => {
let [ case_number, location, age_bracket, gender, info ] = row.innerText.split('\t')
let obj = {
id: case_number,
case_number,
status: '',
date_confirmed: '',
date_suspected: '',
location_history: [
{
date: '',
location,
description: ''
},
],
media_release_url: '',
media_release_description: '',
additional_info: [
{
info,
source_url: 'https://www.health.govt.nz/our-work/diseases-and-conditions/covid-19-novel-coronavirus/covid-19-current-cases'
}
],
related_cases: [
],
gender,
age_bracket
}
console.log(obj)
arr = [obj, ...arr]
}
)
JSON.stringify(arr).replace(/"([^,\[\{]*)?":/g,'$1:')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment