aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorAndrés Maldonado <amaldona@etu.utc.fr>2018-12-11 15:05:42 +0100
committerChocobozzz <me@florianbigard.com>2019-02-12 11:19:19 +0100
commit4e553a41fdc67c4da186502522ac99a5ba230453 (patch)
tree116b3d461c496a3bbc011daeec02619a0b1e1c09 /server/helpers
parent31d065cc50e17a9abf263ed8c606cb272cd4933d (diff)
downloadPeerTube-4e553a41fdc67c4da186502522ac99a5ba230453.tar.gz
PeerTube-4e553a41fdc67c4da186502522ac99a5ba230453.tar.zst
PeerTube-4e553a41fdc67c4da186502522ac99a5ba230453.zip
Import original publication date (web UI)
Import original publication date when importing a video from YouTube in the web UI
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/youtube-dl.ts7
1 files changed, 6 insertions, 1 deletions
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