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

我也很难从一个频道获得视频URL,所以我切换到了Google.Apis.YouTube.v3

GitHub页面谷歌Api dotnet客户端
或者只需通过nuget从visual studio 下载

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,请查看以下内容:如何从YouTube获取频道id?

相关内容

  • 没有找到相关文章

最新更新