我使用tweetstream gem从Twitter流API获取示例tweet:
TweetStream.configure do |config|
config.username = 'my_username'
config.password = 'my_password'
config.auth_method = :basic
end
@client = TweetStream::Client.new
@client.sample do |status|
puts "#{status.text}"
end但是,该脚本将在大约100条tweet之后停止输出tweet(脚本继续运行)。有什么问题吗?
发布于 2012-01-04 07:38:23
Twitter为事物设置了某些任意(从外部)限制,从医生那里
获取状态/:id/ retweeted _by显示最多100个转发状态的用户对象。
从宝石上,该方法的代码是:
# Returns a random sample of all public statuses. The default access level
# provides a small proportion of the Firehose. The "Gardenhose" access
# level provides a proportion more suitable for data mining and
# research applications that desire a larger proportion to be statistically
# significant sample.
def sample(query_parameters = {}, &block)
start('statuses/sample', query_parameters, &block)
end我检查了API文档,但没有看到“statuse/sample”的条目,但是看看上面的条目,我假设您已经访问了100种状态/xxx。
另外,如果我错了,请纠正我,但我相信Twitter不再接受基本的命令,您必须使用OAuth密钥。如果是这样的话,那就意味着您没有经过身份验证,而且search也会在其他方面限制您,请参阅https://dev.twitter.com/docs/rate-limiting
希望这能有所帮助。
好的,我在那里犯了一个错误,我在查看search的时候,我应该看看流API (我很抱歉),但是我所说的一些事情可能是导致您的问题的原因,所以我就不提了。Twitter显然已经脱离了基本习惯,所以我会尝试先解决这个问题,参见:
https://stackoverflow.com/questions/8722967
复制相似问题