Youtube API v3无法回复或评价任何评论 [英] Youtube API v3 Can't reply or rate on any comment
问题描述
我正在尝试通过API进行评论和评分,但是资源总是 canRate:false
和 canReply:false
一世我已经尝试通过google javascript客户端和http获取请求,但是似乎没有任何效果.
I am trying to comment and rate a comment via API but the resource is always
canRate: false
and canReply: false
I
I've tried through google javascript client and http get request, but nothing seems to be working.
$http.get('https://www.googleapis.com/youtube/v3/commentThreads', {
params: {
key: API_KEY,
part: 'snippet',
textFormat: 'plainText',
videoId: VIDEO_ID,
order: 'relevance'
}
}).success(function(response) {
$scope.comments = response.items;
$log.debug($scope.comments);
//var author = item.snippet.topLevelComment.snippet.authorDisplayName;
//var comment = item.snippet.topLevelComment.snippet.textDisplay;
//var nextToken = results.nextPageToken;
//var totalRep = item.snippet.totalReplyCount;
//var parent = item.snippet.topLevelComment.id;
})
.error(function(error) {
$log.error(error);
})
这就是我正在使用的东西,我可以完美地列出它们(即使使用 v3/comments
),但是不能回复评论,这是我正在使用的东西
This is what I'm using, I can list them perfectly (even using v3/comments
) but can't reply neither rate a comment, this is what I'm using
gapi.client.load('youtube', 'v3', function () {
$scope.selectedComment.snippet.viewerRating = 'like';
var request = gapi.client.youtube.commentThreads.update({
part: "snippet",
body: $scope.selectedComment
});
request.execute(function(response) {
$log.debug(response);
});
});
在 body
部分,我也尝试过
body: {
id: $scope.selectedCommentId,
'snippet': {
'viewerRating': 'like'
}
}
但是我得到这个错误
404找不到指定的注释线程.检查值在
id
属性中请求正文以确保其正确
404 The specified comment thread could not be found. Check the value of the
id
property in the request body to ensure that it is correct
推荐答案
您可以重播评论
POST https://www.googleapis.com/youtube/v3/comments?part=snippet&access_token={YOUR_API_KEY}
body
{
"snippet": {
"parentId": "parentCommentID",
"textOriginal": "yoursComment"
}
}
您可以在此处获取更多信息 https://developers.google.com/youtube/v3/docs/comments/insert#examples
You can get more info here https://developers.google.com/youtube/v3/docs/comments/insert#examples
这篇关于Youtube API v3无法回复或评价任何评论的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!