【发布时间】:2015-09-02 10:38:06
【问题描述】:
我正在尝试使用 .net YouTube API v.3.0 来检索 cmets 线程。我基本上是在尝试重用sample for Java,但是当我尝试使用我的客户端机密进行授权时,我的令牌没有得到任何范围(当我检查凭据变量时它设置为 null)。这是我从 .net 示例中获取的代码:
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
new[] { YouTubeService.Scope.YoutubeForceSsl},
"user",
CancellationToken.None,
new FileDataStore(this.GetType().ToString())
);
我可以列出我上传的所有视频,但我无法使用以下代码为他们获取 cmets 线程:
var req = youtubeService.CommentThreads.List("snippet");
req.VideoId = playlistItem.Snippet.ResourceId.VideoId;
req.TextFormat = CommentThreadsResource.ListRequest.TextFormatEnum.PlainText;
var res = req.Execute();
“youtubeService”是通过传递之前创建的“credential”变量创建的。使用 .net 获得 cmets 的人是否更幸运?
【问题讨论】:
-
Java 示例,取自 .net 示例?
-
您发布的代码有什么问题,是出现错误还是没有数据?
-
我收到 HTTP 403:禁止,权限不足。我设法找到了解决方案,请参阅下面的评论。
标签: c# youtube youtube-api youtube-data-api