-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught Exception converting t.co links #125
Comments
Would you show us your version of earthquake.gem and /Users/seppo/.earthquake/plugin/expand_tco.rb ? 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:
|
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:in
block (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:in
block 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:in
transport_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:in
request_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:in
start' from /opt/local/lib/ruby1.9/1.9.1/net/http.rb:557:in
start'from /Users/seppo/.earthquake/plugin/expand_tco.rb:9:in
block (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:in
block (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:in
block (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:in
any?' 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:in
reverse_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:in
block 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:in
output' 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:in
call' 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:in
synchronize' 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:in
block (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'
The text was updated successfully, but these errors were encountered: