【发布时间】:2018-05-12 18:57:56
【问题描述】:
您好,我使用带有预定日期和时间的 nodejs 在 youtube 上上传视频,并使用以下代码正确上传。我想在此处放置一些参数,以便在特定时间取消发布或将其设为私有。例如,在下面的示例中,如果我上传视频,那么它将在 2017 年 12 月 28 日 16:10:00 公开。哪个工作正常。但是,如果我想将此视频设置为在 2018 年 1 月 28 日 16:10:00 自动取消发布/私有。我该怎么做?
const publishDate = new Date("2017-12-28 16:10:00");
var req = Youtube.videos.insert({
resource: {
snippet: {
title: "Dummy video to test scheduled time"
, description: "Dummy video to test scheduled time"
}
, status: {
privacyStatus: "private",
publishAt: publishDate //Scheduled
}
}
// This is for the callback function
, part: "snippet,status"
// Create the readable stream to upload the video
, media: {
body: fs.createReadStream("video.mp4")
}
}, (err, data) => {
console.log("Done.");
process.exit();
});
【问题讨论】:
标签: node.js youtube youtube-data-api