Truncate chapters from youtube-dl

This commit is contained in:
Chocobozzz 2024-07-31 10:13:28 +02:00
parent f1afdeaa61
commit bba6538435
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 7 additions and 1 deletions

View File

@ -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)
}
})
: []
}
}