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.
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| article_tag = SemanticHtml.find_tag_in_ancestors(selected_tag, tag_name) if article_tag && (article_hash = Extractor.new(article_tag, url: @url).call) yield article_hash end end end end |