首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ruby tweetstream意外停止

Ruby tweetstream意外停止
EN

Stack Overflow用户
提问于 2012-01-04 06:35:14
回答 1查看 682关注 0票数 0

我使用tweetstream gem从Twitter流API获取示例tweet:

代码语言:javascript
复制
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(脚本继续运行)。有什么问题吗?

EN

回答 1

Stack Overflow用户

发布于 2012-01-04 07:38:23

Twitter为事物设置了某些任意(从外部)限制,从医生那里

获取状态/:id/ retweeted _by显示最多100个转发状态的用户对象。

从宝石上,该方法的代码是:

代码语言:javascript
复制
# 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://dev.twitter.com/docs/auth/oauth/faq

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8722967

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档