Koala使用postId获取Facebook帖子并获取评论数,例如count,share count

时间:2018-09-26 05:12:41

标签: ruby-on-rails ruby facebook-graph-api rubygems

这是我的代码,我得到我的信息,然后收到此错误

require 'koala'
access_token ='a_very_long_access_token'
@graph = Koala::Facebook::API.new(access_token)    

all_comments = @graph.get_connections(2194339320618344, "comments", limit: 100)
puts all_commnets
post_insights = @graph.get_object(2194339320618344, :fields => "likes.summary(true)")
puts post_insights

结果是

{"name"=>"Google", "id"=>"1998966816826828"}
{"birthday"=>"08/07/1990", "id"=>"1998966816826828"}
{"email"=>"google@yahoo.com", "id"=>"1998966816826828"}
Traceback (most recent call last):
2: from rand.rb:19:in `<main>'
1: from /Users/sino/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/koala-3.0.0/lib/koala/api/graph_api_methods.rb:56:in `get_object'
/Users/sino/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/koala-3.0.0/lib/koala/api.rb:50:in
`graph_call': type: GraphMethodException, code: 100, error_subcode: 33, message: Unsupported get request.Object with ID '2194339320618344' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api, x-fb-trace-id: G9x4gx1hW5k [HTTP 400] (Koala::Facebook::ClientError)

0 个答案:

没有答案