Method: Html2rss::AutoSource#articles

Defined in:
lib/html2rss/auto_source.rb

#articlesObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/html2rss/auto_source.rb', line 40

def articles
  @articles ||= Scraper.from(parsed_body).flat_map do |scraper|
    instance = scraper.new(parsed_body, url:)

    articles_in_thread = Parallel.map(instance.each) do |article_hash|
      Log.debug "Scraper: #{scraper} in worker: #{Parallel.worker_number} [#{article_hash[:url]}]"

      Article.new(**article_hash, scraper:)
    end

    Reducer.call(articles_in_thread, url:)

    articles_in_thread
  end
end