c# - 如何从 Youtube 列出用户的历史记录?

标签 c# youtube-api google-api

我一直在用这个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/

相关文章:

c# - 开发人员使用哪种设计模式 Abp 框架 (abp.io)?

youtube - 如何通过 API 从自动生成的 YouTube channel 的播放列表中获取视频列表?

android - 发布已签名的 Android 应用程序,Google Plus 登录和 Google map 无法正常工作

java - Android 应用 map View 中只有卫星模式

android - 在Youtube Intent或Youtube Player中获取选定的视频

python - Youtube 上传到自己的帐户

c# - 错误报告

c# - 导航属性(集合)一次只存储一个值

c# - 如何在 .NET Core 中获取操作系统、计算机处理器信息、总 RAM、正在使用的 RAM 等?

php - 如何检查 YouTube channel 名称是否存在?