Youtube API V3 Insert Comment Issue

陌路散爱 提交于 2020-01-02 09:27:54

问题


I'm essentially using the sample code provided by the docs here but I'm getting an error that reads ArgumentError - unknown keyword: snippet. Does anyone else have this problem as well? I'm not sure if this is a valid bug but intuitively the sample code they provide should work right?

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

回答1:


Upon digging through the actual library, I discovered that the way to pass in the snippet part is as follows:

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)

Hope this saves someone from a huge headache of having to chase through their docs



来源:https://stackoverflow.com/questions/44769985/youtube-api-v3-insert-comment-issue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!