Module: Html2rss::FeedResolution

Defined in:
lib/html2rss/feed_resolution.rb,
lib/html2rss/feed_resolution/diag.rb,
lib/html2rss/feed_resolution/probe.rb,
lib/html2rss/feed_resolution/policy.rb,
lib/html2rss/feed_resolution/scorer.rb,
lib/html2rss/feed_resolution/options.rb,
lib/html2rss/feed_resolution/candidate_generator.rb

Overview

Entry URL tournament for weak homepage/hub extracts.

Defined Under Namespace

Modules: Policy, Scorer Classes: ApplyOutcome, CandidateGenerator, Diag, Options, Orchestrator, Probe, Result, Runner

Constant Summary collapse

DEFAULT_CONFIG =

Default entry-resolution options merged into AutoSource::DEFAULT_CONFIG.

{
  enabled: true,
  max_probes: 5
}.freeze

Class Method Summary collapse

Class Method Details

.call(entry_url:, response:, session:, config:, articles:, surface_category: nil) ⇒ Result

rubocop:disable-next Metrics/ParameterLists -- tournament kwargs stay co-located

Parameters:

Returns:



37
38
39
40
41
# File 'lib/html2rss/feed_resolution.rb', line 37

def self.call(entry_url:, response:, session:, config:, articles:, surface_category: nil)
  Runner.new(
    entry_url:, response:, session:, config:, articles:, surface_category:
  ).call
end

.request_slots_for(auto_source) ⇒ Integer

Returns entry-resolution budget slots (probes + retry GET when enabled).

Parameters:

  • auto_source (Hash, nil)

Returns:

  • (Integer)

    entry-resolution budget slots (probes + retry GET when enabled)



22
23
24
25
26
# File 'lib/html2rss/feed_resolution.rb', line 22

def self.request_slots_for(auto_source)
  return 0 unless auto_source

  Options.from_auto_source(auto_source).request_slots
end

.try_apply!(pipeline:, config:, response:, session:, strategy:, resources:, articles:, scrape_target:, state:, budget:) ⇒ ApplyOutcome?

Runs the tournament and, when a winner applies, re-fetches and re-extracts articles.

rubocop:disable-next Metrics/ParameterLists -- orchestration kwargs stay co-located

Parameters:

Returns:

  • (ApplyOutcome, nil)

    :succeeded sticky scrape target when retry extract yielded items; nil when no winner or retry was empty (entry scrape target kept; Diag.applied may still be true)



63
64
65
66
67
68
69
# File 'lib/html2rss/feed_resolution.rb', line 63

def self.try_apply!(pipeline:, config:, response:, session:, strategy:, resources:, articles:,
                    scrape_target:, state:, budget:)
  Orchestrator.new(
    pipeline:, config:, response:, session:, strategy:, resources:, articles:,
    scrape_target:, state:, budget:
  ).call
end