YouTube API支持标签吗? [英] Are tags supported in YouTube API?

查看:98
本文介绍了YouTube API支持标签吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个iOS应用,可让您开始YouTube直播.我想在此广播中添加标签.

I'm working on an iOS app that will let you start a live YouTube broadcast. I would like to add tags to this broadcast.

在API文档的此页面上,我注意到可以为snippet.tags[]属性设置一个值,这似乎正是我所需要的.但是,当我看GTLYouTubeLiveBroadcastSnippet.h时;我看到以下属性:

Looking at this page on the API documentation, I noticed that it is possible to set a value for the snippet.tags[] property, which seems to be exactly what I need. When I look at GTLYouTubeLiveBroadcastSnippet.h, however; I see the following properties:

@interface GTLYouTubeLiveBroadcastSnippet : GTLObject

@property (retain) GTLDateTime *actualEndTime;

@property (retain) GTLDateTime *actualStartTime;

@property (copy) NSString *channelId;

@property (retain) GTLDateTime *publishedAt;

@property (retain) GTLDateTime *scheduledEndTime;

@property (retain) GTLDateTime *scheduledStartTime;

@property (retain) GTLYouTubeThumbnailDetails *thumbnails;

@property (copy) NSString *title;

但是我没有看到任何有关标签的信息. Google员工-是否可以创建实时流并添加标签?谢谢!

But I don't see anything regarding tags. Google folks--is it possible to create a live stream and add tags?? Thank you!

推荐答案

您所引用的API文档与常规YouTube视频有关;就API而言,YouTube实时广播具有不同的数据模型.不幸的是,标签字段没有直接用于实时广播的读取或写入.

The API documentation you're referring to pertains to regular YouTube videos; YouTube live broadcasts have a different data model as far as the API is concerned. Unfortunately, the tags field is not exposed for reading or writing for live broadcasts directly.

但是,有一种解决方法.创建liveBroadcast对象后,您将获取返回的videoID并将其用于常规数据API调用中……具体来说,您将要使用video/update端点并在其中添加snippet.tags数据(请注意,对于有效的更新调用,您还需要再次设置snippet.title和snippet.categoryId).

There is a way around this, however. Once you've created your liveBroadcast object, you then take the videoID that's returned and use it in regular data API calls ... specifically, you'll want to use the videos/update endpoint and add in the snippet.tags data there (note that, for a valid update call, you'll be required to also once again set the snippet.title and snippet.categoryId).

我刚刚验证了它可以通过API资源管理器工作,因此,这似乎是使用API​​将标签添加到实时事件中的最佳方法.

I've just verified that this works via the API explorer, so it seems to be the best way to get tags onto live events with the API.

这篇关于YouTube API支持标签吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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