【发布时间】:2015-10-21 01:11:08
【问题描述】:
我正在使用 twitter gem 搜索推文,并且我想将搜索结果限制为每个函数调用 10 条推文。我正在使用以下功能
class SayController < ApplicationController
def hello
@tweets = $twitter.search("google", options = {count: 10})
end
end
但我仍然收到了数千条推文,而且它在几个页面加载中耗尽了我的 api 速率限制
我也试过了
@tweets = $twitter.search("google", count: 10)
和
@tweets = $twitter.search("google", count: => 10, :result_type => "recent")
但它从不考虑计数变量,也不限制获取的推文数量。我按照http://www.rubydoc.info/gems/twitter/Twitter/REST/Search 此处的文档进行操作,但我不明白为什么它不起作用
【问题讨论】:
-
你用的是什么版本?如果您尝试使用参数
rpp而不是count会怎样?
标签: ruby-on-rails ruby twitter