【问题标题】:Youtube API V3 Insert Comment IssueYoutube API V3 插入评论问题
【发布时间】:2017-11-29 21:35:31
【问题描述】:

我基本上使用的是文档here 提供的示例代码,但我收到了一个错误,显示为ArgumentError - unknown keyword: snippet。其他人也有这个问题吗?我不确定这是否是一个有效的错误,但直观地说他们提供的示例代码应该可以正常工作吗?

properties = {
                'snippet.parentId': '123',
                'snippet.textOriginal': message
            }
            resource = create_resource(properties)
            response = service.insert_comment('snippet', resource)

【问题讨论】:

  • 引号中有'sn-p'吗?
  • @MiguelMota 是的,我试图基本上只是复制并粘贴他们的示例代码,并进行细微的更改。我已经更新了我的帖子以显示我目前所写的内容。经过进一步调试,问题似乎是snippetparentIdsnippettextOriginal 中的snippet 未被识别

标签: ruby api youtube


【解决方案1】:

通过实际库的挖掘,发现sn-p部分的传入方式如下:

snippet = Google::Apis::YoutubeV3::CommentSnippet.new(parent_id: parent_id, text_original: message)
comment = Google::Apis::YoutubeV3::Comment.new(snippet: snippet)

response = service.insert_comment('snippet', comment)

希望这可以使某人免于不得不追逐他们的文档的巨大头痛

【讨论】:

  • 非常感谢@Tim,它真的很有帮助。
猜你喜欢
  • 2015-08-23
  • 2020-01-03
  • 2016-08-27
  • 1970-01-01
  • 1970-01-01
  • 2020-06-27
  • 2018-04-14
  • 2013-09-20
  • 2016-09-01
相关资源
最近更新 更多