From 2ecaa54e18299d22c867dc39ecda340dfa917c9e Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Fri, 15 Dec 2023 21:13:32 +0100 Subject: [PATCH] Bugfixes --- src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index e1e0ae7..7461382 100644 --- a/src/index.ts +++ b/src/index.ts @@ -44,16 +44,16 @@ export function parse_youtube(content: string): Timestamp[] { content .split("\n") .filter((l) => l.length > 4) - .map((l) => l.match(/([0-9]{1,}:[0-9]{2})\s(.*)/)) + .map((l) => l.match(/(([0-9]:)?[0-9]{1,2}:[0-9]{2})\s(.*)/)) ); return ( content .split("\n") .filter((l) => l.length > 4) - .map((l) => l.match(/([0-9]{1,}:[0-9]{2})\s(.*)/)) + .map((l) => l.match(/(([0-9]:)?[0-9]{1,2}:[0-9]{2})\s(.*)/)) .filter((m) => m != null) as string[][] - ).map(([_, time_s, title]) => ({ - title, + ).map(([_, time_s, __, title]) => ({ + title: title.replace(/^\s*[-:]\s+/, ""), timestamp: parseTimestamp(time_s), })); }