Method: Html2rss::AutoSource::Scraper.from

Defined in:
lib/html2rss/auto_source/scraper.rb

.from(parsed_body) ⇒ Array<Class>

Returns an array of scrapers that claim to find articles in the parsed body.

Parameters:

  • parsed_body (Nokogiri::HTML::Document)

    The parsed HTML body.

Returns:

  • (Array<Class>)

    An array of scraper classes that can handle the parsed body.

Raises:



26
27
28
29
30
31
# File 'lib/html2rss/auto_source/scraper.rb', line 26

def self.from(parsed_body)
  scrapers = SCRAPERS.select { |scraper| scraper.articles?(parsed_body) }
  raise NoScraperFound, 'No suitable scraper found for URL.' if scrapers.empty?

  scrapers
end