我一直在用这个library用于访问 youtube。我想从 youtube 中列出用户的历史记录。我用谷歌搜索了它,但找不到此 Youtube API V3 的示例。
在下面的代码中,我能够列出用户家中的提要。
public void GetRecommended(ref List<string> videoList)
{
YouTubeService youtube = new YouTubeService(new BaseClientService.Initializer()
{
ApiKey = GoogleCredentials.apiKey,
Authenticator = this.authenticator
});
// Create the request
ActivitiesResource.ListRequest listRequest = youtube.Activities.List("contentDetails");
listRequest.Home = true;
listRequest.MaxResults = 10;
// Fetch the response
ActivityListResponse listResponse = listRequest.Execute();
foreach (var item in listResponse.Items)
{
videoList.Add(item.ContentDetails.Upload.VideoId);
}
}
如何列出用户在 Youtube 上的历史记录?
最佳答案
你可以用 channels->list 做到这一点请求。
在响应中,contentDetails.relatedPlaylists将为您提供“喜欢”、“收藏夹”、“上传”、“watchHistory”和“watchLater”的播放列表 ID。
然后你可以调用playlistItems->list使用设置 playlistId这些 ID 的参数以遍历视频。
关于c# - 如何从 Youtube 列出用户的历史记录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18202447/