I have created a program where the user enters a YouTube channel name and it does a search and returns and displays YouTube channels with similar names based on their relevancy. Then the user picks what channel that they want and the program saves the ChannelID. Then I want to get a list of all of the channels videos so i can display a random video to the user from that channel. The issue is that the old method of using a channels "Uploads" playlist no longer works as I believe that channels don't have this playlist anymore by default. The code I am currently using to get the channels videos has its own issues.
SearchListResponse response; var search = service.Search.List(repeatable); search.Type = "video"; search.ChannelId = Session["ChannelID"].ToString(); search.MaxResults = 500; do { response = search.ExecuteAsync().Result; foreach (SearchResult sr in response.Items) { videoIds.Add(sr.Id.VideoId); } search.PageToken = response.NextPageToken; } while (response.NextPageToken != "");The issue with this method is that it uses 100 quota per search but only returns 50 videos at a time. And if a user has 1000 videos it would take 20 searches aka 2000 quota (20% of daily quota) just to get the channels VideoID's.
I believe there are two ways to fix this:
From a single request, get a random video from the channel
OR
Get all VideoIDs from the channel and then pick a random one.