使用 Youtube API 获取视频的隐私设置 [英] Get video's privacy settings using Youtube API

查看:27
本文介绍了使用 Youtube API 获取视频的隐私设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Youtube 视频管理器中,我可以选择将视频设置为 a) 公开 b) 私人和 c) 不公开.

In Youtube video manager, I have the option to set a video to a) Public b) Private and c) Unlisted.

使用 Youtube API,是否可以找出视频当前的设置?

Using the Youtube API, is it possible to find out what the setting of a video is currently?

谢谢

推荐答案

视情况而定.

我将在 YouTube 数据 API v3 的上下文中回答,其中是最新版本.API 的旧版 v1 和 v2 中有类似的方法.

I'm going to answer in the context of the YouTube Data API v3, which is the most recent release. There are analogous methods in the older v1 and v2 of the API.

如果您经过身份验证是视频的所有者,您可以制作 videos.list(part=status, id=VIDEO_ID) 调用,视频的状态将在 video.status.privacyStatus 属性.

If you're authenticated as the owner of the video, you can make a videos.list(part=status, id=VIDEO_ID) call, and the video's status will be returned in the video.status.privacyStatus property.

如果您未通过身份验证为视频的所有者,您可以进行相同的 videos.list() 调用,但如果视频是 private,则您赢了得不到回应.如果视频是 publicunlisted 你会得到一个视频资源,你可以检查 video.status.privacyStatus 来看看确切的隐私级别为.

If you're not authenticated as the owner of the video, you can make the same videos.list() call, but if the video is private you won't get back a response. If the video is public or unlisted you will get back a video resource, and you could check video.status.privacyStatus to see what the exact privacy level is.

这篇关于使用 Youtube API 获取视频的隐私设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆