Are tags supported in YouTube API?

∥☆過路亽.° 提交于 2019-12-12 00:17:17

问题


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.

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;

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


回答1:


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.

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).

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.



来源:https://stackoverflow.com/questions/31391767/are-tags-supported-in-youtube-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!