From bba6538435a06b744b03233f138a06978cb9e45f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 31 Jul 2024 10:13:28 +0200 Subject: [PATCH] Truncate chapters from youtube-dl --- server/core/helpers/youtube-dl/youtube-dl-info-builder.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/core/helpers/youtube-dl/youtube-dl-info-builder.ts b/server/core/helpers/youtube-dl/youtube-dl-info-builder.ts index 66993d2ee..3b3223487 100644 --- a/server/core/helpers/youtube-dl/youtube-dl-info-builder.ts +++ b/server/core/helpers/youtube-dl/youtube-dl-info-builder.ts @@ -90,8 +90,14 @@ export class YoutubeDLInfoBuilder { originallyPublishedAtWithoutTime: this.buildOriginallyPublishedAt(obj), ext: obj.ext, webpageUrl: obj.webpage_url, + chapters: isArray(obj.chapters) - ? obj.chapters.map((c: { start_time: number, title: string }) => ({ timecode: c.start_time, title: c.title })) + ? obj.chapters.map((c: { start_time: number, title: string }) => { + return { + timecode: c.start_time, + title: c.title.slice(0, CONSTRAINTS_FIELDS.VIDEO_CHAPTERS.TITLE.max) + } + }) : [] } }