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

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

.articles?(parsed_body) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
29
# File 'lib/html2rss/auto_source/scraper/schema.rb', line 23

def articles?(parsed_body)
  parsed_body.css(TAG_SELECTOR).any? do |script|
    (Thing::SUPPORTED_TYPES | ItemList::SUPPORTED_TYPES).any? do |type|
      script.text.match?(/"@type"\s*:\s*"#{Regexp.escape(type)}"/)
    end
  end
end