小编Jor*_*nth的帖子

Youtube Data API v3:喜欢另一个用户的评论

我想使用 Youtube Data API 来点赞评论。当我尝试喜欢自己的评论时,它可以正常工作,没有任何问题,但是当我尝试喜欢其他人的评论时,我会收到错误。

"reason": "invalidCommentMetadata",
"message": "The request metadata is invalid.",
Run Code Online (Sandbox Code Playgroud)

我正在使用 Google API PHP 客户端。

这是我用来更新的代码:

$videoComments = $youtube->comments->listComments('snippet', array(
     'id' => $comment->id
));

$videoComments[0]->snippet->viewerRating = 'like';

$videoCommentUpdateResponse = $youtube->comments->update('snippet', $videoComments[0]);
Run Code Online (Sandbox Code Playgroud)

我相信这是做到这一点的方法,因为当我查看文档时,我发现唯一影响类似的是“viewerRating”。

https://developers.google.com/youtube/v3/docs/comments#properties

snippet.viewerRating string 观看者对此评论的评分。请注意,此属性当前无法识别不喜欢评级,但此行为可能会发生变化。同时,财产价值就像观众对评论给予积极评价一样。

在所有其他情况下,该值为 none,包括用户对评论给予负面评级或未对评论进行评级。

此属性的有效值为: - 类似 - 无

我不知道我是否做错了什么,或者这是否可能。我希望有人能在这里帮助我。

php youtube google-api-php-client youtube-data-api

4
推荐指数
1
解决办法
2426
查看次数