Method: Html2rss::AutoSource::Scraper::SemanticHtml#each

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

#each {|The| ... } ⇒ Enumerator

Returns Enumerator for the scraped articles.

Yield Parameters:

  • The (Hash)

    scraped article hash

Returns:

  • (Enumerator)

    Enumerator for the scraped articles



103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/html2rss/auto_source/scraper/semantic_html.rb', line 103

def each
  return enum_for(:each) unless block_given?

  SemanticHtml.anchor_tag_selector_pairs.each do |tag_name, selector|
    parsed_body.css(selector).each do |selected_tag|
       = SemanticHtml.find_tag_in_ancestors(selected_tag, tag_name)

      if  && (article_hash = Extractor.new(, url: @url).call)
        yield article_hash
      end
    end
  end
end