YouTube数据API v3:就像其他用户的评论一样 [英] Youtube Data API v3: like comment of another user

查看:55
本文介绍了YouTube数据API v3:就像其他用户的评论一样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用YouTube数据API喜欢评论.当我尝试喜欢自己的评论时,它没有任何问题,但是当我尝试喜欢别人的评论时,我得到了一个错误.

I want to use the Youtube Data API to like comments. When I try to like a comment from myself it works without any problem, but when I try to like a comment from someone else I get an error.

"reason": "invalidCommentMetadata",
"message": "The request metadata is invalid.",

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

I am using the Google API PHP Client.

这是我用来更新类似代码的代码:

This is the code that I use to update the like:

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

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

$videoCommentUpdateResponse = $youtube->comments->update('snippet', $videoComments[0]);

我相信这是实现此目的的方法,因为当我查看文档时,唯一可以影响到类似内容的是`viewerRating.

I believe this is the way to do this, because when I look at the docs the only thing that I can find that affects the like is the `viewerRating.

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

snippet.viewer评级字符串 观众对此的评分 评论.请注意,此属性当前无法识别不喜欢的对象 收视率,尽管这种行为可能会发生变化.同时, 属性值就像观看者对评论进行评分 肯定地.

snippet.viewerRating string The rating the viewer has given to this comment. Note that this property does not currently identify dislike ratings, though this behavior is subject to change. In the meantime, the property value is like if the viewer has rated the comment positively.

在所有其他情况下(包括用户已给 评论为负面评论或未对评论进行评论.

The value is none in all other cases, including the user having given the comment a negative rating or not having rated the comment.

此属性的有效值为: - 喜欢 -没有

Valid values for this property are: - like - none

我不知道我做错了什么还是什至有可能.我希望有人可以在这里帮助我.

I don't know if I do something wrong, or if this is even possible. I hope someone can help me out here.

推荐答案

我认为可以安全地断定此功能不存在是出于以下原因,

I think it's safe to conclude this feature does not exist for the following reasons,

否则,详尽的API文档未提及此功能.我非常怀疑youtube/google会忘记记录功能. 在SO上,这个问题已经问过好几次了;所有这些都没有可接受的答案(1、2、3).最古老的问题是10个月大的,如果确实存在此功能,几乎没有人会发现它. Youtube是选民投票者的常见目标,因此,不提供API入口点作为第一道防线是有道理的. 官方的Youtube(android)应用程序不提供评论增值选项,而仅提供标记和回复选项.如果存在注释评论功能,您可能会认为Youtube会在自己的应用中展示该功能.

The otherwise thorough API documentation makes no mention of this feature. I highly doubt youtube/google would forget to document a feature. This question has been asked several times before on SO; all of which have no accepted answer (1, 2, 3). With the oldest question being 10 months old, it's very unlikely no one would have found this feature if it did exist. Youtube is a common target of voter-bots and hence it would make sense to not offer an API entry-point as a first line of defense. The official Youtube (android) app offers no comment-upvote option but only flag and reply options. If a comment-upvote feature would exist, you'd think Youtube would show it off in their own app.

这篇关于YouTube数据API v3:就像其他用户的评论一样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆