使用nodejs从youtube data api v3 Ubpublish /制作私人YouTube视频

时间:2017-11-29 06:34:38

标签: node.js youtube youtube-data-api

您好我使用具有预定日期和时间的nodejs在youtube上上传视频,并使用以下代码正确上传。我想在这里放置一些参数,以便可以在某个特定时间取消发布或将其设为私有。例如,如果我上传视频,那么它将在2017-12-28 16:10:00公开。哪个工作正常。但是如果我想在2018-01-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();
        });

1 个答案:

答案 0 :(得分:0)

正如我所看到的,上传时没有这种方式可以传递ubpublish日期。我已使用更新视频选项处理此问题。 如果有人提供更好的解决方案,那就太好了。