+ if (typeof value === 'string') {
+ newObj[key] = value.normalize()
+ } else {
+ newObj[key] = value
+ }
+ }
+
+ return newObj
+ }
+
+ private buildVideoInfo (obj: any): YoutubeDLInfo {
+ return {
+ name: this.titleTruncation(obj.title),
+ description: this.descriptionTruncation(obj.description),
+ category: this.getCategory(obj.categories),
+ licence: this.getLicence(obj.license),
+ language: this.getLanguage(obj.language),
+ nsfw: this.isNSFW(obj),
+ tags: this.getTags(obj.tags),
+ thumbnailUrl: obj.thumbnail || undefined,
+ originallyPublishedAt: this.buildOriginallyPublishedAt(obj),
+ ext: obj.ext
+ }
+ }
+
+ private titleTruncation (title: string) {
+ return peertubeTruncate(title, {
+ length: CONSTRAINTS_FIELDS.VIDEOS.NAME.max,
+ separator: /,? +/,
+ omission: ' […]'
+ })
+ }
+
+ private descriptionTruncation (description: string) {
+ if (!description || description.length < CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.min) return undefined