Improve first line lookup

This commit is contained in:
Dennis Reimann
2024-06-18 08:35:03 +02:00
parent 6899fb7f27
commit 049a35ef2e

View File

@@ -55,7 +55,8 @@ const parseEpisode = e => {
if (categoryName === 'Buchclub') categoryName = 'Lesestunde'
if (categoryName === 'reCATion') categoryName = 'Verschiedenes'
if (categoryName === 'NostrTalk') categoryName = 'NostrTalk'
const firstLine = descriptionPlain.split('\n').find(l => l.match(regexBlockzeit)) || ''
const lines = descriptionPlain.trim().split('\n')
const firstLine = lines.find(l => l.match(regexBlockzeit)) || lines[0] || ''
const blockMatch = firstLine.match(regexBlockzeit)
const block = blockMatch ? parseInt(blockMatch[1].replace('.', '')) : null
const category = slugify(categoryName)