aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tools
diff options
context:
space:
mode:
Diffstat (limited to 'server/tools')
-rw-r--r--server/tools/peertube-import-videos.ts23
1 files changed, 11 insertions, 12 deletions
diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts
index d04ddfe06..1b2c63af2 100644
--- a/server/tools/peertube-import-videos.ts
+++ b/server/tools/peertube-import-videos.ts
@@ -124,19 +124,18 @@ function processVideo (parameters: {
124 const videoInfo = await fetchObject(youtubeInfo) 124 const videoInfo = await fetchObject(youtubeInfo)
125 log.debug('Fetched object.', videoInfo) 125 log.debug('Fetched object.', videoInfo)
126 126
127 if (program['since']) { 127 const originallyPublishedAt = buildOriginallyPublishedAt(videoInfo)
128 if (buildOriginallyPublishedAt(videoInfo).getTime() < program['since'].getTime()) { 128
129 log.info('Video "%s" has been published before "%s", don\'t upload it.\n', 129 if (program['since'] && originallyPublishedAt && originallyPublishedAt.getTime() < program['since'].getTime()) {
130 videoInfo.title, formatDate(program['since'])) 130 log.info('Video "%s" has been published before "%s", don\'t upload it.\n',
131 return res() 131 videoInfo.title, formatDate(program['since']))
132 } 132 return res()
133 } 133 }
134 if (program['until']) { 134
135 if (buildOriginallyPublishedAt(videoInfo).getTime() > program['until'].getTime()) { 135 if (program['until'] && originallyPublishedAt && originallyPublishedAt.getTime() > program['until'].getTime()) {
136 log.info('Video "%s" has been published after "%s", don\'t upload it.\n', 136 log.info('Video "%s" has been published after "%s", don\'t upload it.\n',
137 videoInfo.title, formatDate(program['until'])) 137 videoInfo.title, formatDate(program['until']))
138 return res() 138 return res()
139 }
140 } 139 }
141 140
142 const result = await searchVideoWithSort(url, videoInfo.title, '-match') 141 const result = await searchVideoWithSort(url, videoInfo.title, '-match')