More robust import script when using since/until
This commit is contained in:
parent
f98c395295
commit
d8794cf855
|
@ -124,19 +124,18 @@ function processVideo (parameters: {
|
||||||
const videoInfo = await fetchObject(youtubeInfo)
|
const videoInfo = await fetchObject(youtubeInfo)
|
||||||
log.debug('Fetched object.', videoInfo)
|
log.debug('Fetched object.', videoInfo)
|
||||||
|
|
||||||
if (program['since']) {
|
const originallyPublishedAt = buildOriginallyPublishedAt(videoInfo)
|
||||||
if (buildOriginallyPublishedAt(videoInfo).getTime() < program['since'].getTime()) {
|
|
||||||
log.info('Video "%s" has been published before "%s", don\'t upload it.\n',
|
if (program['since'] && originallyPublishedAt && originallyPublishedAt.getTime() < program['since'].getTime()) {
|
||||||
videoInfo.title, formatDate(program['since']))
|
log.info('Video "%s" has been published before "%s", don\'t upload it.\n',
|
||||||
return res()
|
videoInfo.title, formatDate(program['since']))
|
||||||
}
|
return res()
|
||||||
}
|
}
|
||||||
if (program['until']) {
|
|
||||||
if (buildOriginallyPublishedAt(videoInfo).getTime() > program['until'].getTime()) {
|
if (program['until'] && originallyPublishedAt && originallyPublishedAt.getTime() > program['until'].getTime()) {
|
||||||
log.info('Video "%s" has been published after "%s", don\'t upload it.\n',
|
log.info('Video "%s" has been published after "%s", don\'t upload it.\n',
|
||||||
videoInfo.title, formatDate(program['until']))
|
videoInfo.title, formatDate(program['until']))
|
||||||
return res()
|
return res()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await searchVideoWithSort(url, videoInfo.title, '-match')
|
const result = await searchVideoWithSort(url, videoInfo.title, '-match')
|
||||||
|
|
Loading…
Reference in New Issue