]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/videos/import.ts
Use originallyPublishedAt from body on import if it exists
[github/Chocobozzz/PeerTube.git] / server / controllers / api / videos / import.ts
index e9b9d68d73fd07e5b48ed13c0b213205e0aa2728..f4630375eea7cc4c770faf0d6813c864b33e18a9 100644 (file)
@@ -172,11 +172,12 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response)
     user
   })
 
-
   // Get video subtitles
   try {
     const subtitles = await getYoutubeDLSubs(targetUrl)
 
+    logger.info('Will create %s subtitles from youtube import %s.', subtitles.length, targetUrl)
+
     for (const subtitle of subtitles) {
       const videoCaption = new VideoCaptionModel({
         videoId: video.id,
@@ -230,7 +231,7 @@ function buildVideo (channelId: number, body: VideoImportCreate, importData: You
     privacy: body.privacy || VideoPrivacy.PRIVATE,
     duration: 0, // duration will be set by the import job
     channelId: channelId,
-    originallyPublishedAt: importData.originallyPublishedAt
+    originallyPublishedAt: body.originallyPublishedAt || importData.originallyPublishedAt
   }
   const video = new VideoModel(videoData)
   video.url = getVideoActivityPubUrl(video)