如何收集实时推文? [英] How can I collect real-time tweets?

查看:43
本文介绍了如何收集实时推文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 Ruby 收集实时推文并将其存储在 MongoDB 中?请给我一个提示!我试过使用这个代码 1 并且总是得到这个,但不知道如何处理它...

How can I collect real-time tweets using Ruby and store them in MongoDB? Please give me a hint! I've tried to use this code 1 and always get this one and dont know how to deal with it...

C:/Ruby187/lib/ruby/1.8/net/protocol.rb:135:in `sysread': 既存の接続はリモート
ホストに強制的に切断されました。 (Errno::ECONNRESET)
        from C:/Ruby187/lib/ruby/1.8/net/protocol.rb:135:in `rbuf_fill'
        from C:/Ruby187/lib/ruby/1.8/timeout.rb:67:in `timeout'
        from C:/Ruby187/lib/ruby/1.8/timeout.rb:101:in `timeout'
        from C:/Ruby187/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
        from C:/Ruby187/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
        from C:/Ruby187/lib/ruby/1.8/net/protocol.rb:126:in `readline'
        from C:/Ruby187/lib/ruby/1.8/net/http.rb:2028:in `read_status_line'
        from C:/Ruby187/lib/ruby/1.8/net/http.rb:2017:in `read_new'
        from C:/Ruby187/lib/ruby/1.8/net/http.rb:1051:in `request'
        from stream.rb:19
        from C:/Ruby187/lib/ruby/1.8/net/http.rb:543:in `start'
        from C:/Ruby187/lib/ruby/1.8/net/http.rb:440:in `start'
        from stream.rb:15

推荐答案

尝试将 URL 从 http://stream.twitter.com/1/statuses/sample.json 更改为 https://stream.twitter.com/1/statuses/sample.json,流媒体 API 现在只能通过 SSL 使用(您链接的 Gist 已有一年历史).

Try changing the URL from http://stream.twitter.com/1/statuses/sample.json to https://stream.twitter.com/1/statuses/sample.json, the streaming API is only available via SSL nowadays (the Gist you linked to is a year old).

这篇关于如何收集实时推文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆