0

我在将帖子发布到页面时遇到问题,并且只会收到有用的错误:
OAuthException :: (#1) An error occured while creating the share

前 20 个左右的帖子效果很好,然后开始出错。
facebook对一个页面(垃圾邮件)的帖子数量有限制吗?

我可以复制表格rails c,我已经三次检查了我的 access_token 并且可以直接从 FB 手动发布。
(我使用的pageaccess_token 不是我user的)

我在 FbGraph 的 githup 上打开了一个问题,但 nov 似乎认为这是一个 FB 问题。

我的代码:

    admin = Admin.first

    page = FbGraph::Page.new(admin.facebook_page_id)

    Story.where(:facebook_post_id => nil).all.each do |story|
      post = page.feed!(
        :link => 'http://www.example.com/stories/'+story.cached_slug,
        :access_token => admin.facebook_page_access_token
      )

      story.facebook_post_id = post.identifier
      story.live = true
      story.save

      sleep 1
    end

回溯:

FbGraph::InvalidRequest: OAuthException :: (#1) An error occured while creating the share
    from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/fb_graph-2.6.4/lib/fb_graph/exception.rb:47:in `block in handle_httpclient_error'
    from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/fb_graph-2.6.4/lib/fb_graph/exception.rb:44:in `each'
    from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/fb_graph-2.6.4/lib/fb_graph/exception.rb:44:in `handle_httpclient_error'
    from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/fb_graph-2.6.4/lib/fb_graph/node.rb:142:in `handle_response'
    from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/fb_graph-2.6.4/lib/fb_graph/node.rb:55:in `post'
    from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/fb_graph-2.6.4/lib/fb_graph/connections/feed.rb:14:in `feed!'
    from (irb):9:in `block in irb_binding'
    from (irb):5:in `each'
    from (irb):5
    from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/commands/console.rb:47:in `start'
    from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/commands/console.rb:8:in `start'
    from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

更新:

看起来我的 access_token 被禁止了 24 小时。

在再次出现此错误之前,我只能向页面添加另外 28 个帖子。这次我尝试了 10 秒的睡眠,但仍然被禁止...我想我明天会尝试 60 秒的睡眠.. :(

4

1 回答 1

0

我无法解决这个问题,但我已经解决了这个问题。

通过每 3 分钟上传 1 个帖子,我每天可以收到 200-300 个帖子。

admin = Admin.first

page = FbGraph::Page.new(admin.facebook_page_id)

Story.where(:facebook_post_id => nil).all.each do |story|
  post = page.feed!(
    :link => 'http://www.example.com/stories/'+story.cached_slug,
    :access_token => admin.facebook_page_access_token
  )

  story.facebook_post_id = post.identifier
  story.live = true
  story.save

  sleep 180
end

我希望这可以帮助其他人解决这个问题。

于 2013-06-05T04:19:37.883 回答