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

查看:98
本文介绍了使用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 Data 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天全站免登陆