Dulos Adam Dulos Adam - 1 year ago 60
Ruby Question

How can I collect real-time tweets?

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

Answer Source

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).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download