From 049a35ef2e8f35dbb4cac49e63b652869c1985da Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Tue, 18 Jun 2024 08:35:03 +0200 Subject: [PATCH] Improve first line lookup --- tasks/fetch_feed.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/fetch_feed.js b/tasks/fetch_feed.js index ba387124d1c..b2ca5999b9d 100644 --- a/tasks/fetch_feed.js +++ b/tasks/fetch_feed.js @@ -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)