fixup! Add web mentions
This commit is contained in:
21
lib/adamantium/link_finder.rb
Normal file
21
lib/adamantium/link_finder.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
require "uri"
|
||||
|
||||
module Adamantium
|
||||
class LinkFinder
|
||||
IGNORE_LIST = %w[twitter.com
|
||||
instagram.com
|
||||
google.com
|
||||
overcast.fm
|
||||
youtube.com
|
||||
github.com]
|
||||
|
||||
def call(content)
|
||||
links = URI::DEFAULT_PARSER.extract(content)
|
||||
|
||||
links.reject do |link|
|
||||
link.end_with?(":") ||
|
||||
IGNORE_LIST.include?(URI.parse(link).host)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user