如何列出用户';s Youtube的历史

本文关键字:Youtube 历史 何列出 用户 | 更新日期: 2023-09-27 18:27:30

我一直在使用这个库访问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中列出用户的历史记录?

如何列出用户';s Youtube的历史

您可以使用通道->列表请求来完成此操作。

在响应中,contentDetails.relatedPlaylists将为您提供"点赞"、"收藏夹"、"上传"、"watchHistory"answers"watchLater"的播放列表ID。

然后,您可以调用playlistItems->list,并将playlistId参数设置为这些ID来迭代视频。