This commit is contained in:
Kuba Orlik 2023-12-15 21:13:32 +01:00
parent 5efabcdc62
commit 2ecaa54e18

View File

@ -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),
}));
}