当我浏览Google YouTube DATA API时,我找到了对象gapi.client.youtube.commentThreads.insert,我尝试使用它,但我不知道如何使用它,而且Data API文档没有详细说明,{ {3}}。
我尝试编写并运行上面的代码,但它返回错误400
代码:
var c = new gapi.client.youtube.commentThreads.insert(
{
"part":"snippet"
},{
'snippet.channelId': 'UC_x5XG1OV2P6uZZ5FSM9Ttw',
'snippet.videoId':'NeF0zpT4gNE',
'snippet.topLevelComment.snippet.textOriginal':'Hello from API'
});
c.execute();
响应
{
"error": {
"errors": [
{
"domain": "youtube.commentThread",
"reason": "channelOrVideoIdMissing",
"message": "Each comment thread must be linked to a channel or video.\u003cul\u003e\u003cli\u003eIf the comment applies to a channel, make sure that the resource specified in the request body provides a value for the \u003ccode\u003e\u003ca href=\"/youtube/v3/docs/commentThreads#snippet.channelId\"\u003esnippet.channelId\u003c/a\u003e\u003c/code\u003e property. A comment that applies to a channel appears on the channels \u003cb\u003eDiscussion\u003c/b\u003e tab.\u003c/li\u003e\u003cli\u003eIf the comment applies to a video, make sure the resource specifies values for both the \u003ccode\u003e\u003ca href=\"/youtube/v3/docs/commentThreads#snippet.channelId\"\u003esnippet.channelId\u003c/a\u003e\u003c/code\u003e and \u003ccode\u003e\u003ca href=\"/youtube/v3/docs/commentThreads#snippet.videoId\"\u003esnippet.videoId\u003c/a\u003e\u003c/code\u003e properties. A comment that applies to a video appears on the videos watch page.\u003c/li\u003e\u003c/ul\u003e",
"locationType": "other",
"location": "body.snippet"
}
],
"code": 400,
"message": "Each comment thread must be linked to a channel or video.\u003cul\u003e\u003cli\u003eIf the comment applies to a channel, make sure that the resource specified in the request body provides a value for the \u003ccode\u003e\u003ca href=\"/youtube/v3/docs/commentThreads#snippet.channelId\"\u003esnippet.channelId\u003c/a\u003e\u003c/code\u003e property. A comment that applies to a channel appears on the channels \u003cb\u003eDiscussion\u003c/b\u003e tab.\u003c/li\u003e\u003cli\u003eIf the comment applies to a video, make sure the resource specifies values for both the \u003ccode\u003e\u003ca href=\"/youtube/v3/docs/commentThreads#snippet.channelId\"\u003esnippet.channelId\u003c/a\u003e\u003c/code\u003e and \u003ccode\u003e\u003ca href=\"/youtube/v3/docs/commentThreads#snippet.videoId\"\u003esnippet.videoId\u003c/a\u003e\u003c/code\u003e properties. A comment that applies to a video appears on the videos watch page.\u003c/li\u003e\u003c/ul\u003e"
}
}
答案 0 :(得分:1)
我找到了解决方案,我是愚蠢的,因为参数必须通过对象传递 - 这是使用此函数的人的示例。
SELECT city, prod, p1, p2, p3
FROM (SELECT city, prod, p1, p2, p3,
ROW_NUM() OVER (PARTITION BY city, prod ORDER BY p3 DESC) AS rn
FROM mytable) t
WHERE rn = 1