mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig.space.git
synced 2025-12-13 16:26:50 +00:00
Improve shownotes parsing
This commit is contained in:
@@ -36,6 +36,8 @@ const json2xmlOpts = {
|
|||||||
indentBy: ' '
|
indentBy: ' '
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const regexBlockzeit = /Blockzeit\s(\d+(?:\.)?\d+)/
|
||||||
|
|
||||||
const parser = new XMLParser(xml2jsonOpts, true)
|
const parser = new XMLParser(xml2jsonOpts, true)
|
||||||
const builder = new XMLBuilder(json2xmlOpts)
|
const builder = new XMLBuilder(json2xmlOpts)
|
||||||
|
|
||||||
@@ -53,9 +55,9 @@ const parseEpisode = e => {
|
|||||||
if (categoryName === 'Buchclub') categoryName = 'Lesestunde'
|
if (categoryName === 'Buchclub') categoryName = 'Lesestunde'
|
||||||
if (categoryName === 'reCATion') categoryName = 'Verschiedenes'
|
if (categoryName === 'reCATion') categoryName = 'Verschiedenes'
|
||||||
if (categoryName === 'NostrTalk') categoryName = 'NostrTalk'
|
if (categoryName === 'NostrTalk') categoryName = 'NostrTalk'
|
||||||
const firstLine = descriptionPlain.split('\n')[0]
|
const firstLine = descriptionPlain.split('\n').find(l => l.match(regexBlockzeit)) || ''
|
||||||
const blockMatch = firstLine.match(/Blockzeit\s(\d+)/)
|
const blockMatch = firstLine.match(regexBlockzeit)
|
||||||
const block = blockMatch ? parseInt(blockMatch[1]) : null
|
const block = blockMatch ? parseInt(blockMatch[1].replace('.', '')) : null
|
||||||
const category = slugify(categoryName)
|
const category = slugify(categoryName)
|
||||||
const slug = slugify(`${categoryName} ${number || ''} ${titlePlain}`)
|
const slug = slugify(`${categoryName} ${number || ''} ${titlePlain}`)
|
||||||
const date = new Date(e.pubDate)
|
const date = new Date(e.pubDate)
|
||||||
|
|||||||
Reference in New Issue
Block a user