aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/controllers/api/videos/import.ts3
-rw-r--r--server/helpers/youtube-dl.ts7
-rw-r--r--shared/models/videos/import/video-import.model.ts1
3 files changed, 9 insertions, 2 deletions
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts
index 7053d5253..626c81eca 100644
--- a/server/controllers/api/videos/import.ts
+++ b/server/controllers/api/videos/import.ts
@@ -172,7 +172,8 @@ function buildVideo (channelId: number, body: VideoImportCreate, importData: You
172 support: body.support || null, 172 support: body.support || null,
173 privacy: body.privacy || VideoPrivacy.PRIVATE, 173 privacy: body.privacy || VideoPrivacy.PRIVATE,
174 duration: 0, // duration will be set by the import job 174 duration: 0, // duration will be set by the import job
175 channelId: channelId 175 channelId: channelId,
176 originallyPublishedAt: importData.originallyPublishedAt
176 } 177 }
177 const video = new VideoModel(videoData) 178 const video = new VideoModel(videoData)
178 video.url = getVideoActivityPubUrl(video) 179 video.url = getVideoActivityPubUrl(video)
diff --git a/server/helpers/youtube-dl.ts b/server/helpers/youtube-dl.ts
index b74351b42..4d4b37ef9 100644
--- a/server/helpers/youtube-dl.ts
+++ b/server/helpers/youtube-dl.ts
@@ -16,6 +16,7 @@ export type YoutubeDLInfo = {
16 nsfw?: boolean 16 nsfw?: boolean
17 tags?: string[] 17 tags?: string[]
18 thumbnailUrl?: string 18 thumbnailUrl?: string
19 originallyPublishedAt?: string
19} 20}
20 21
21const processOptions = { 22const processOptions = {
@@ -173,6 +174,9 @@ function normalizeObject (obj: any) {
173} 174}
174 175
175function buildVideoInfo (obj: any) { 176function buildVideoInfo (obj: any) {
177
178 const date = obj.upload_date.slice(0,4)+","+obj.upload_date.slice(4,6)+","+obj.upload_date.slice(6,8)
179
176 return { 180 return {
177 name: titleTruncation(obj.title), 181 name: titleTruncation(obj.title),
178 description: descriptionTruncation(obj.description), 182 description: descriptionTruncation(obj.description),
@@ -180,7 +184,8 @@ function buildVideoInfo (obj: any) {
180 licence: getLicence(obj.license), 184 licence: getLicence(obj.license),
181 nsfw: isNSFW(obj), 185 nsfw: isNSFW(obj),
182 tags: getTags(obj.tags), 186 tags: getTags(obj.tags),
183 thumbnailUrl: obj.thumbnail || undefined 187 thumbnailUrl: obj.thumbnail || undefined,
188 originallyPublishedAt: new Date(date).toISOString()
184 } 189 }
185} 190}
186 191
diff --git a/shared/models/videos/import/video-import.model.ts b/shared/models/videos/import/video-import.model.ts
index e2a56617d..92856c70f 100644
--- a/shared/models/videos/import/video-import.model.ts
+++ b/shared/models/videos/import/video-import.model.ts
@@ -11,6 +11,7 @@ export interface VideoImport {
11 11
12 createdAt: string 12 createdAt: string
13 updatedAt: string 13 updatedAt: string
14 originallyPublishedAt?: string
14 state: VideoConstant<VideoImportState> 15 state: VideoConstant<VideoImportState>
15 error?: string 16 error?: string
16 17