Youtube API - 如何设置游戏标题

时间:2016-10-07 01:18:08

标签: c# youtube-api

我正在用C#编写一个项目,目的是自动化我的流媒体准备工作。

我已经成功创建了一个流和广播,但在为广播分配视频游戏标题时我失败了。

我收到状态200,但仍然没有改变。

liveBroadcast = new LiveBroadcast();
liveBroadcast.Status = new LiveBroadcastStatus();
liveBroadcast.Status.PrivacyStatus = "private";
liveBroadcast.Snippet = new LiveBroadcastSnippet();
liveBroadcast.Snippet.Title = title;
liveBroadcast.Snippet.Description = description;
liveBroadcast.Snippet.ScheduledStartTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 19, 0, 0, 0);
liveBroadcast.Snippet.ScheduledEndTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 21, 0, 0, 0);
liveBroadcast.TopicDetails = new LiveBroadcastTopicDetails();
liveBroadcast.TopicDetails.Topics = new List<LiveBroadcastTopic>();

var liveBroadcastTopic = new LiveBroadcastTopic();
liveBroadcastTopic.Type = "videoGame";
liveBroadcastTopic.Unmatched = false;
liveBroadcastTopic.Snippet = new LiveBroadcastTopicSnippet();
liveBroadcastTopic.Snippet.Name = "ARMA 3";
liveBroadcastTopic.Snippet.ReleaseDate = "2013";

liveBroadcast.TopicDetails.Topics.Add(liveBroadcastTopic);

liveBroadcast = await youtubeService.LiveBroadcasts.Insert(liveBroadcast, "status,snippet,topicDetails").ExecuteAsync();

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

Youtube尚未实现通过其API设置流的游戏标题的方法。

所以我的解决方案是创建一个浏览器类,从已安装的浏览器导入cookie,并在youtubes视频编辑页面上只对常常发布的帖子。

不是最干净或最好的方法,但它有效。

这种方法在API中实现时将被弃用和编辑。 (目前未知的时刻)