From 4e553a41fdc67c4da186502522ac99a5ba230453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Maldonado?= Date: Tue, 11 Dec 2018 15:05:42 +0100 Subject: Import original publication date (web UI) Import original publication date when importing a video from YouTube in the web UI --- server/helpers/youtube-dl.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'server/helpers') 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 = { nsfw?: boolean tags?: string[] thumbnailUrl?: string + originallyPublishedAt?: string } const processOptions = { @@ -173,6 +174,9 @@ function normalizeObject (obj: any) { } function buildVideoInfo (obj: any) { + + const date = obj.upload_date.slice(0,4)+","+obj.upload_date.slice(4,6)+","+obj.upload_date.slice(6,8) + return { name: titleTruncation(obj.title), description: descriptionTruncation(obj.description), @@ -180,7 +184,8 @@ function buildVideoInfo (obj: any) { licence: getLicence(obj.license), nsfw: isNSFW(obj), tags: getTags(obj.tags), - thumbnailUrl: obj.thumbnail || undefined + thumbnailUrl: obj.thumbnail || undefined, + originallyPublishedAt: new Date(date).toISOString() } } -- cgit v1.2.3