2016-03-23 86 views
3

我们需要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); 
+0

我已经装在Youtube上的视频,我需要检查,如果这个加载,过滤它们的通道和ID –

+0

上面的代码,如果YouTube的API V2,这是过时了一年前。你需要使用v3。 – johnh10

回答

2

我也有麻烦的视频网址,频道做它自己的方式,所以我切换到Google.Apis.YouTube.v3

GitHub Page google Api dotnet client
或通过的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

foreach (var video in searchListResult.Items.toList()) { 
    var videoUrl = "https://www.youtube.com/watch?v=" + video.Id.VideoId 
    // DO YOUR STUFF 
} 
得到SearchResult所组成的枚举

要在此了解自己的频道ID看看:How can I get a channel ID from YouTube?

相关问题