我在向网页发帖时遇到问题,只收到有用的错误:
OAuthException :: (#1) An error occured while creating the share
前20个左右的帖子效果很好,然后就开始出错了 Facebook对页面(垃圾邮件)或其他内容的帖子数量有限制吗?
我可以复制表格rails c
,我已经三次检查了我的access_token,可以直接从FB手动发布。
(我正在使用page
access_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秒...... :(
答案 0 :(得分: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
我希望这可以帮助其他人解决这个问题。