mirror of
https://github.com/comatory/fb2iCal
synced 2025-01-16 10:21:07 +01:00
27 lines
537 B
JavaScript
27 lines
537 B
JavaScript
const { parse } = require('node-html-parser')
|
|
|
|
const parseHTML = (html) => {
|
|
let data = {}
|
|
|
|
const root = parse(html)
|
|
const eventSummary = root.querySelector('#event_summary')
|
|
|
|
const timeInfo = eventSummary.querySelector('#event_time_info')
|
|
const timeContent = timeInfo.querySelector('[content]')
|
|
|
|
if (
|
|
timeContent &&
|
|
timeContent.attributes &&
|
|
timeContent.attributes.content
|
|
) {
|
|
data = {
|
|
...data,
|
|
time: timeContent.attributes.content.value,
|
|
}
|
|
}
|
|
|
|
return data
|
|
}
|
|
|
|
module.exports = parseHTML
|