gpt4 book ai didi

c# - Youtube Api 获取 channel 上的所有视频(不再可用错误)

转载 作者:行者123 更新时间:2023-11-30 16:03:39 26 4
gpt4 key购买 nike

我们需要 YouTube channel 名称列表的视频(使用 API)。当我发出请求时,出现以下错误:Error No longer available

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

最佳答案

我也无法按照您的方式从 channel 获取视频网址,所以我切换到 Google.Apis.YouTube.v3

GitHub Page google Api dotnet client
或者直接从 visual studio 通过 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
}

要获取您的 channel ID,请查看:How can I get a channel ID from YouTube?

关于c# - Youtube Api 获取 channel 上的所有视频(不再可用错误),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36182547/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com