首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Youtube /v3/search API不再返回现场视频

Youtube /v3/search API不再返回现场视频
EN

Stack Overflow用户
提问于 2019-09-10 18:33:21
回答 4查看 1.8K关注 0票数 9

我使用YouTube搜索API通过通道ID检索实时视频,但最近,API已经开始返回一个空响应。

例如,我正在从https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&eventType=live&key={YOUTUBE_KEY}&channelId=UCPde4guD9yFBRzkxk2PatoA检索,它应该返回从channelID = UCPde4guD9yFBRzkxk2PatoA现场直播的所有视频。这个频道有一个24/7的直播流,但我得到的响应是:

代码语言:javascript
复制
{
 "kind": "youtube#searchListResponse",
 "etag": "\"8jEFfXBrqiSrcF6Ee7MQuz8XuAM/-f6JA5_OcXz2RWuH1mpAA2_9mM8\"",
 "regionCode": "US",
 "pageInfo": {
  "totalResults": 0,
  "resultsPerPage": 5
 },
 "items": []
}

正如我前面提到的,直到最近,这个请求还在检索数据罚款。我无法在YouTube API文档上找到任何更改,所以我想知道是否有人知道什么改变了,或者是否有不同的方法可以通过通道ID来提取实时视频。

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2019-09-17 15:59:46

这不是一个答案,但似乎端点没有返回任何最近的视频,包括现场直播。据我所知,它没有返回在前24小时发布的任何内容。

在Google Support https://support.google.com/youtube/thread/14611425?hl=en上发现了一个悬而未决的问题

票数 4
EN

Stack Overflow用户

发布于 2020-03-04 03:59:32

作为另一种选择,您可以加载“上载”播放列表,检查https://stackoverflow.com/a/27872244/2154075

票数 1
EN

Stack Overflow用户

发布于 2020-08-20 11:41:47

试试这段代码

代码语言:javascript
复制
   async static Task<IEnumerable<YouTubeVideo>> GetVideosList(Configurations configurations, string searchText = "", int maxResult = 20)
    {
        List<YouTubeVideo> videos = new List<YouTubeVideo>();

        using (var youtubeService = new YouTubeService(new BaseClientService.Initializer()
        {
            ApiKey = configurations.ApiKey
        }))
        {
            var searchListRequest = youtubeService.Search.List("snippet");
            searchListRequest.Q = searchText;
            searchListRequest.MaxResults = maxResult;
            searchListRequest.ChannelId = configurations.ChannelId;
            searchListRequest.Type = "video";
            searchListRequest.Order = SearchResource.ListRequest.OrderEnum.Date;// Relevance;


            var searchListResponse = await searchListRequest.ExecuteAsync();


            foreach (var responseVideo in searchListResponse.Items)
            {
                videos.Add(new YouTubeVideo()
                {
                    Id = responseVideo.Id.VideoId,
                    Description = responseVideo.Snippet.Description,
                    Title = responseVideo.Snippet.Title,
                    Picture = GetMainImg(responseVideo.Snippet.Thumbnails),
                    Thumbnail = GetThumbnailImg(responseVideo.Snippet.Thumbnails)
                });
            }

            return videos;
        }

    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57876494

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档