【问题标题】:Youtube Api to fetch all videos on a Channel ( No longer available Error)用于获取频道上所有视频的 Youtube Api(不再可用错误)
【发布时间】:2016-07-11 00:03:18
【问题描述】:

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

【问题讨论】:

  • 我已经在Youtube上加载了视频,我需要检查是否加载,过滤他们的频道和ID
  • 以上代码如果 YouTube API v2 在一年前已被弃用。您需要使用 v3。

标签: c# youtube-api


【解决方案1】:

我也无法按照您的方式从频道获取视频网址,因此我切换到 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 中获得了 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?

【讨论】:

    猜你喜欢
    • 2013-09-28
    • 2015-07-16
    • 2016-08-05
    • 2015-03-11
    • 2015-09-02
    • 2016-03-01
    • 2016-03-12
    • 2018-03-30
    相关资源
    最近更新 更多