/// <summary> /// Retrieves list of last N videos from given channel /// </summary> /// <param name="channel">Channel</param> /// <param name="lastVideos">How many last videos should be listed</param> /// <returns>Last N videos</returns> public List <Video> ChannelLastVideos(ChannelEntity channel, int lastVideos) { var searchListRequest = _service.Search.List("snippet"); searchListRequest.MaxResults = lastVideos; searchListRequest.ChannelId = ChannelIdByChannelUrl(channel.Link); searchListRequest.Type = "video"; searchListRequest.Order = SearchResource.ListRequest.OrderEnum.Date; var searchListResponse = searchListRequest.Execute(); return(searchListResponse.Items.Select(response => new Video { YtApiResult = response }).ToList()); }
/// <summary> /// Retrieves list of last N videos from given channel /// </summary> /// <param name="channel">Channel</param> /// <param name="lastVideos">How many last videos should be listed</param> /// <returns>Last N videos</returns> public List <SearchResult> ChannelLastVideos(ChannelEntity channel, int lastVideos) { var result = new List <SearchResult>(); var searchListRequest = _service.Search.List("snippet"); searchListRequest.MaxResults = lastVideos; searchListRequest.ChannelId = ChannelIdByChannelUrl(channel.Link); searchListRequest.Type = "video"; searchListRequest.Order = SearchResource.ListRequest.OrderEnum.Date; var searchListResponse = searchListRequest.Execute(); result.AddRange(searchListResponse.Items); return(result); }