Method: Html2rss::AutoSource::Scraper::SemanticHtml.articles?

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

.articles?(parsed_body) ⇒ Boolean

Check if the parsed_body contains articles

Parameters:

  • parsed_body (Nokogiri::HTML::Document)

    The parsed HTML document

Returns:

  • (Boolean)

    True if articles are found, otherwise false.



36
37
38
39
40
41
42
43
# File 'lib/html2rss/auto_source/scraper/semantic_html.rb', line 36

def self.articles?(parsed_body)
  return false unless parsed_body

  ANCHOR_TAG_SELECTORS.each_value do |selectors|
    return true if selectors.any? { |selector| parsed_body.at_css(selector) }
  end
  false
end