lib/awesome_bot/links.rb in awesome_bot-1.3.0 vs lib/awesome_bot/links.rb in awesome_bot-1.3.1

- old
+ new

@@ -4,10 +4,19 @@ class << self def links_filter(list) list.reject { |x| x.length < 9 } .map do |x| - x.gsub(/\).*/, '').gsub(/'.*/, '').gsub(/,.*/, '').gsub('/:', '/') + x.gsub(/'.*/, '').gsub(/,.*/, '').gsub('/:', '/') + end + .map do |x| + if x.scan(')').count == 2 + x.gsub(/\)\).*/, ')') + elsif x.scan(')').count == 1 + x.gsub(/\).*/, '') + else + x + end end end def links_find(content) URI.extract(content, /http()s?/)