9

I was using the YouTube search API to retrieve live videos by channel ID, but recently, the API has begun to return an empty response.

For example, I am retrieving from https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&eventType=live&key={YOUTUBE_KEY}&channelId=UCPde4guD9yFBRzkxk2PatoA which should return all videos which are live from channelID = UCPde4guD9yFBRzkxk2PatoA. This channel has a 24/7 live stream, but the response I get back is:

{
 "kind": "youtube#searchListResponse",
 "etag": "\"8jEFfXBrqiSrcF6Ee7MQuz8XuAM/-f6JA5_OcXz2RWuH1mpAA2_9mM8\"",
 "regionCode": "US",
 "pageInfo": {
  "totalResults": 0,
  "resultsPerPage": 5
 },
 "items": []
}

As I mentioned before, this request was retrieving data fine up until recently. I was unable to find any changes on the YouTube API docs, so I'm wondering if anyone has any idea on what changed or if there's a different approach I can take to pull live videos by channel ID.

Kagrenac
  • 3
  • 2
ceejayc7
  • 163
  • 7

4 Answers4

4

Not an answer, but it seems that endpoint isn't returning ANY recent videos that would include live. From what I can tell it doesn't return anything published in the previous 24 hours.

Found an open issue on Google Support https://support.google.com/youtube/thread/14611425?hl=en

1

As an alternative, instead, you could load "uploads" playlist, check https://stackoverflow.com/a/27872244/2154075

IvanM
  • 2,913
  • 2
  • 30
  • 30
0

try this code

   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;
        }

    }
Omar Maher
  • 45
  • 4
0
M.Ali El-Sayed
  • 1,608
  • 20
  • 23