我正在尝试获取Youtube注释,但它引发了此异常-
{“ Google.Apis.Requests.RequestError \ r \ n权限不足:请求的身份验证范围不足。[403] \ r \ nErrors [\ r \ n \ tMessage [权限不足:请求的身份验证范围不足。]位置[-]原因[insufficientPermissions]域[全局] \ r \ n] \ r \ n“}
凭据源代码-
UserCredential credsDataApi = GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
new[] { YouTubeService.Scope.YoutubeForceSsl, YouTubeService.Scope.Youtubepartner, YouTubeAnalyticsService.Scope.YtAnalyticsReadonly, YouTubeAnalyticsService.Scope.YtAnalyticsMonetaryReadonly, YouTubeAnalyticsService.Scope.Youtube, "https://www.googleapis.com/auth/plus.login" },
"user",
CancellationToken.None,
new FileDataStore(Directory.GetCurrentDirectory() + "\\MetadataAccessToken\\" + channelinfo.DataAPIFileDataStore, true)
).Result;
这是引发异常的行-
UserCredential credsDataApi = YouTubeHelper.GetUserCredentialForDataAPI(channelinfo);
var youtubeServiceComments = new YouTubeService(new BaseClientService.Initializer()
{
HttpClientInitializer = credsDataApi,
ApplicationName = channelinfo.DataAPIFileDataStore
});
var searchCommentThreadlistRequest = youtubeServiceComments.CommentThreads.List(“ snippet”); var searchCommentThreadlistResponse = searchCommentThreadlistRequest.ExecuteAsync(); 如果( searchCommentThreadlistResponse.Result.Items.Count > 0){ }
能请你帮忙吗?