通过在 Youtube 上插入设置 Public 统计数据 API
Setting Public statistics via insert on Youtube API
我正在使用 Java API 将视频上传到 YouTube,如下所示:
YouTube.Videos.Insert videoInsert = youTube.videos().insert("snippet,statistics,status", video, videoInputStreamContent);
videoInsert.getMediaHttpUploader().setDirectUploadEnabled(false);
videoInsert.getMediaHttpUploader().setProgressListener(new UploadProcessListener());
uploadedVideo = videoInsert.execute();
现在客户要我预先设置选项"Make video statistics on the watch page publicly available",但是我在插入的文档中找不到这个选项。
有人知道如何设置这个值吗?
Setting I want to change on the Yoututbe Page after it was updated by the API
此致
我相信您正在寻找 status.publicStatsViewable
,它包含在 videos.insert parameters. The parameter is described in more detail on the Overview page:
中
This value indicates whether the extended video statistics on
the video's watch page are publicly viewable. By default, those
statistics are viewable, and statistics like a video's viewcount and
ratings will still be publicly visible even if this property's value
is set to false.
在您的 Java 代码中,我相信您会想要创建一个 VideoStatus
对象并调用 setPublicStatsViewable()
,然后在您的 video
对象上设置状态:
VideoStatus status = new VideoStatus();
status.setPublicStatsViewable(true);
video.setStatus(status);
// (your existing code)
YouTube.Videos.Insert videoInsert =
youTube.videos().insert("snippet,statistics,status", video, videoInputStreamContent);
...
我正在使用 Java API 将视频上传到 YouTube,如下所示:
YouTube.Videos.Insert videoInsert = youTube.videos().insert("snippet,statistics,status", video, videoInputStreamContent);
videoInsert.getMediaHttpUploader().setDirectUploadEnabled(false);
videoInsert.getMediaHttpUploader().setProgressListener(new UploadProcessListener());
uploadedVideo = videoInsert.execute();
现在客户要我预先设置选项"Make video statistics on the watch page publicly available",但是我在插入的文档中找不到这个选项。 有人知道如何设置这个值吗?
Setting I want to change on the Yoututbe Page after it was updated by the API
此致
我相信您正在寻找 status.publicStatsViewable
,它包含在 videos.insert parameters. The parameter is described in more detail on the Overview page:
This value indicates whether the extended video statistics on the video's watch page are publicly viewable. By default, those statistics are viewable, and statistics like a video's viewcount and ratings will still be publicly visible even if this property's value is set to false.
在您的 Java 代码中,我相信您会想要创建一个 VideoStatus
对象并调用 setPublicStatsViewable()
,然后在您的 video
对象上设置状态:
VideoStatus status = new VideoStatus();
status.setPublicStatsViewable(true);
video.setStatus(status);
// (your existing code)
YouTube.Videos.Insert videoInsert =
youTube.videos().insert("snippet,statistics,status", video, videoInputStreamContent);
...