Class: Nous::Crawler::LinkExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/nous/crawler/link_extractor.rb

Instance Method Summary collapse

Constructor Details

#initialize(url_filter:) ⇒ LinkExtractor

Returns a new instance of LinkExtractor.



8
9
10
# File 'lib/nous/crawler/link_extractor.rb', line 8

def initialize(url_filter:)
  @url_filter = url_filter
end

Instance Method Details

#extract(current_url, html) ⇒ Object



12
13
14
# File 'lib/nous/crawler/link_extractor.rb', line 12

def extract(current_url, html)
  anchors(html).filter_map { |href| resolve(current_url, href) }.uniq
end