Fix import script
This commit is contained in:
parent
3204f4d17d
commit
cbdd81da96
|
@ -131,12 +131,20 @@ async function processVideo (parameters: {
|
||||||
const videoInfo = await fetchObject(youtubeInfo)
|
const videoInfo = await fetchObject(youtubeInfo)
|
||||||
log.debug('Fetched object.', videoInfo)
|
log.debug('Fetched object.', videoInfo)
|
||||||
|
|
||||||
if (options.since && videoInfo.originallyPublishedAt && videoInfo.originallyPublishedAt.getTime() < options.since.getTime()) {
|
if (
|
||||||
|
options.since &&
|
||||||
|
videoInfo.originallyPublishedAtWithoutTime &&
|
||||||
|
videoInfo.originallyPublishedAtWithoutTime.getTime() < options.since.getTime()
|
||||||
|
) {
|
||||||
log.info('Video "%s" has been published before "%s", don\'t upload it.\n', videoInfo.name, formatDate(options.since))
|
log.info('Video "%s" has been published before "%s", don\'t upload it.\n', videoInfo.name, formatDate(options.since))
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.until && videoInfo.originallyPublishedAt && videoInfo.originallyPublishedAt.getTime() > options.until.getTime()) {
|
if (
|
||||||
|
options.until &&
|
||||||
|
videoInfo.originallyPublishedAtWithoutTime &&
|
||||||
|
videoInfo.originallyPublishedAtWithoutTime.getTime() > options.until.getTime()
|
||||||
|
) {
|
||||||
log.info('Video "%s" has been published after "%s", don\'t upload it.\n', videoInfo.name, formatDate(options.until))
|
log.info('Video "%s" has been published after "%s", don\'t upload it.\n', videoInfo.name, formatDate(options.until))
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -212,8 +220,8 @@ async function uploadVideoOnPeerTube (parameters: {
|
||||||
const attributes = {
|
const attributes = {
|
||||||
...baseAttributes,
|
...baseAttributes,
|
||||||
|
|
||||||
originallyPublishedAt: videoInfo.originallyPublishedAt
|
originallyPublishedAtWithoutTime: videoInfo.originallyPublishedAtWithoutTime
|
||||||
? videoInfo.originallyPublishedAt.toISOString()
|
? videoInfo.originallyPublishedAtWithoutTime.toISOString()
|
||||||
: null,
|
: null,
|
||||||
|
|
||||||
thumbnailfile,
|
thumbnailfile,
|
||||||
|
|
Loading…
Reference in New Issue