I have a ASP.Net webpage where I was displaying Youtube Videos from my channel using V2. Since Google has retired V2 API, I am trying to use V3 API, but unable to get the videos from the channel.
I did look at the samples at github, but the example shows how to create a video, but no way to retrieve videos. Searching on SO, I see examples using php library, I am looking something specific to C#.
Can anyone help me with regard to this?
By adding channel id to Search.list it returns a list of the videos in the channel.
var searchListRequest = service.Search.List("snippet");
searchListRequest.ChannelId = "UCIiJ33El2EakaXBzvelc2bQ";
var searchListResult = searchListRequest.Execute();
Update response to comment explanation to what is happening:
Actually search returns everything associated with the channel id, you are after all searching on a channel id.
Search returns a SearchListResponse which contains a number of items. Each item is of type SearchResource search resources can have different types or Kinds. In the two pictures below you can see that the first one is kind youtube#channel
the second is kind youtube#video
it will be up to you to loop though them and find the youtube videos. if you scroll to the bottom of the search.list page you can try it and see the raw JSon that the API is returning.
solution:
Now if all you want to do is get the videos back you can just tell it that all you want are videos by adding type to your request:
searchListRequest.Type = "video";
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments