YouTube API使用C#获得实时广播ID



我想尝试获取youtube Live广播ID。但是我无法理解。这是我的代码:

  UserCredential credential;
        Response.Write("AAA");
        var stream2 = new FileStream("c:/users/gislap/documents/visual studio 2012/Projects/youtube/secrect.json", FileMode.Open, FileAccess.Read);

            credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
                GoogleClientSecrets.Load(stream2).Secrets,
                new[] { YouTubeService.Scope.Youtube },
                "user",
                CancellationToken.None,
                new FileDataStore(this.GetType().ToString())
            );
            Response.Write("DDD");
        var youtubeService = new YouTubeService(new BaseClientService.Initializer()
        {
            HttpClientInitializer = credential,
            ApplicationName = this.GetType().ToString()
        });
        var my_video_request = youtubeService.LiveBroadcasts.ToString();
        Label1.Text = my_video_request.ToString();

或获得所有视频列表的任何方法?

您可以在此线程上参考。如果要检索另一个频道当前的实时广播的信息,则必须使用标准Search/list端点:

part -> snippet

channelId-> [channelId of the channel/user with the live event]

eventType -> live

type -> video(将eventType设置为live时需要)

HTTP GET https://www.googleapis.com/youtube/v3/search?part=snippet&channelId={channelId}&eventType=live&type=video&key={YOUR_API_KEY}

此外,从本文档中,尝试使用此HTTP请求来返回与API请求参数匹配的YouTube广播列表。

GET https://www.googleapis.com/youtube/v3/liveBroadcasts

以下是可能有帮助的示例:

  • https://developers.google.com/youtube/v3/live/code_samples/
  • https://github.com/search?l=c#& q = liveBroadcasts& type = code&utf8=✓

相关内容

  • 没有找到相关文章

最新更新