Published
Edited
Nov 23, 2018
Insert cell
Insert cell
{
let blocks = Array.from(document.querySelectorAll('.block .table'))
let serviceList = blocks.map(b => {
let items = Array.from(b.querySelectorAll('.item'))
let title = `"${items[0].innerText}"`.trim()
let memo = `"${items[1].innerText}"`.replace(/\n/g,'. ')
let line = items[2].innerText
let splits = line.split('·')
let price = splits[0].includes('TBD') ? '' : /\\$(\\d{2,})/.exec(splits[0])[1]
let dur = splits[1]
let hrs = /hr,?/g.test(dur) ? parseInt(/(\\d*) hr/.exec(dur)[1]): 0
let min = /min/g.test(dur) ? parseInt(/(\\d*) min/.exec(dur)[1]) : 0
let duration = hrs * 60 + min
return { title, memo, price, duration }
})
let csv = serviceList.map( s => s.title +',' + s.price +',,' + s.duration + ',,')
return csv.join('\\n')
}

Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more