Open seppo0010 opened 12 years ago
Would you show us your version of earthquake.gem and /Users/seppo/.earthquake/plugin/expand_tco.rb ? This is a problem on custom plugin, I guess.
FYI: shortened urls will be expanded if the tweet includes "entities" when the config[:expand_url] is true since version 0.8.4.
Earthquake v0.9.0
expand_tco.rb:
require 'net/http'
require 'uri'
Earthquake.init do
output_filter do |item|
next unless item['text']
text = item["text"]
text.scan( /http:\/\/t\.co\/[a-zA-Z0-9\-]+/ ).each do |url|
uri = URI.parse url
Net::HTTP::start( uri.host , uri.port ) do |connection|
connection.request_get uri.path do |response|
text.gsub! url , response['Location']
end
end
end
text
end
end
# https://gist.github.com/1385833
Oh, it seems like this crash was discussed in the gist https://gist.github.com/1385833
jaspertandy commented:
Ah, I actually came across a similar issue using this previously. The problem actually stems from the core code of earthquake, in that the tweet body of a retweet is stored in a different variable to a regular tweet, which is quite annoying! I ended up (probably foolishly) making a modification to the core of earthquake to fix the issue for myself, but the modification I've made to the existing gist should skirt the issue (though you may still see t.co in retweets).
No idea when this happens.
/Users/seppo/.earthquake/plugin/expand_tco.rb:11:in
gsub!': can't convert nil into String (TypeError) from /Users/seppo/.earthquake/plugin/expand_tco.rb:11:in
block (5 levels) in <top (required)>' from /opt/local/lib/ruby1.9/1.9.1/net/http.rb:1322:inblock (2 levels) in transport_request' from /opt/local/lib/ruby1.9/1.9.1/net/http.rb:2671:in
reading_body' from /opt/local/lib/ruby1.9/1.9.1/net/http.rb:1321:inblock in transport_request' from /opt/local/lib/ruby1.9/1.9.1/net/http.rb:1316:in
catch' from /opt/local/lib/ruby1.9/1.9.1/net/http.rb:1316:intransport_request' from /opt/local/lib/ruby1.9/1.9.1/net/http.rb:1293:in
request' from /opt/local/lib/ruby1.9/1.9.1/net/http.rb:1195:inrequest_get' from /Users/seppo/.earthquake/plugin/expand_tco.rb:10:in
block (4 levels) in <top (required)>' from /opt/local/lib/ruby1.9/1.9.1/net/http.rb:745:instart' from /opt/local/lib/ruby1.9/1.9.1/net/http.rb:557:in
start' from /Users/seppo/.earthquake/plugin/expand_tco.rb:9:inblock (3 levels) in <top (required)>' from /Users/seppo/.earthquake/plugin/expand_tco.rb:7:in
each' from /Users/seppo/.earthquake/plugin/expand_tco.rb:7:inblock (2 levels) in <top (required)>' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/earthquake-0.9.0/lib/earthquake/output.rb:36:in
call' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/earthquake-0.9.0/lib/earthquake/output.rb:36:inblock (2 levels) in puts_items' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/earthquake-0.9.0/lib/earthquake/output.rb:36:in
each' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/earthquake-0.9.0/lib/earthquake/output.rb:36:inany?' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/earthquake-0.9.0/lib/earthquake/output.rb:36:in
block in puts_items' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/earthquake-0.9.0/lib/earthquake/output.rb:35:inreverse_each' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/earthquake-0.9.0/lib/earthquake/output.rb:35:in
puts_items' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/earthquake-0.9.0/lib/earthquake/output.rb:26:inblock in output' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/earthquake-0.9.0/lib/earthquake/output.rb:56:in
insert' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/earthquake-0.9.0/lib/earthquake/output.rb:23:inoutput' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/earthquake-0.9.0/lib/earthquake/core.rb:127:in
block (4 levels) in start' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/earthquake-0.9.0/lib/earthquake/core.rb:209:incall' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/earthquake-0.9.0/lib/earthquake/core.rb:209:in
block in sync' from internal:prelude:10:insynchronize' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/earthquake-0.9.0/lib/earthquake/core.rb:208:in
sync' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/earthquake-0.9.0/lib/earthquake/core.rb:127:inblock (3 levels) in start' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/earthquake-0.9.0/lib/earthquake/core.rb:125:in
loop' from /opt/local/lib/ruby1.9/gems/1.9.1/gems/earthquake-0.9.0/lib/earthquake/core.rb:125:in `block (2 levels) in start'