Sha256: c8d5225b83987010755365d1519f345282d1b2b754d5206994a42f74b766b001

Contents?: true

Size: 578 Bytes

Versions: 4

Compression:

Stored size: 578 Bytes

Contents

# Get and filter links
module AwesomeBot
  require 'uri'

  class << self
    def links_filter(list)
      list.reject { |x| x.length < 9 }
        .map do |x|
          x.gsub(/'.*/, '').gsub(/,.*/, '').gsub('/:', '/')
        end
        .map do |x|
          if (x.scan(')').count == 2) && (x.scan('(').count == 1)
            x.gsub(/\)\).*/, ')')
          elsif x.scan(')').count > 0
            x.gsub(/\).*/, '')
          else
            x
          end
        end
    end

    def links_find(content)
      URI.extract(content, /http()s?/)
    end
  end # class
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
awesome_bot-1.5.0 lib/awesome_bot/links.rb
awesome_bot-1.4.0 lib/awesome_bot/links.rb
awesome_bot-1.3.3 lib/awesome_bot/links.rb
awesome_bot-1.3.2 lib/awesome_bot/links.rb