Youtube Api可以获取频道上的所有视频(不再可用错误)

时间:2016-03-23 15:39:29

标签: c# youtube-api

我们需要YouTube频道名称列表的视频(使用API​​)。 当我发出请求时,我收到以下错误:错误不再可用

Youtube Api v3。

 Uri urlVideo = new Uri(String.Format("http://gdata.youtube.com/feeds/api/users/{0}/uploads/{1}", hipoConfig.canal_youtube, videoId));
                    //Uri urlVideo = new Uri(String.Format("http://gdata.youtube.com/feeds/users/{0}/uploads/{1}", hipoConfig.canal_youtube, videoId));

                //Google.YouTube.Video videoExistente = request.Retrieve<Video>(urlVideo);
                Video videoExistente = request.Retrieve<Video>(urlVideo);

1 个答案:

答案 0 :(得分:3)

我也无法通过自己的方式从频道获取视频网址,因此我切换到Google.Apis.YouTube.v3

GitHub Page google Api dotnet client
或者只是从视觉工作室通过nuget下载

var yt = new YouTubeService(new BaseClientService.Initializer() { ApiKey = "YOURAPIKEY" });
var searchListRequest = yt.Search.List("snippet");
searchListRequest.Order = SearchResource.ListRequest.OrderEnum.Date;
searchListRequest.MaxResults = 12;
searchListRequest.ChannelId = "NEEDSYOURCHANNELID";
var searchListResult = searchListRequest.Execute();

您在searchListResult.Items

中获得了SearchResults的枚举
foreach (var video in searchListResult.Items.toList()) {
  var videoUrl = "https://www.youtube.com/watch?v=" + video.Id.VideoId
  // DO YOUR STUFF
}

要获取您的频道ID,请查看以下内容:How can I get a channel ID from YouTube?