Class: Html2rss::FeedPipeline::AutoFallback
- Inherits:
-
Object
- Object
- Html2rss::FeedPipeline::AutoFallback
- Defined in:
- lib/html2rss/feed_pipeline/auto_fallback.rb
Overview
Retries feed extraction across concrete request strategies for the :auto plan.
Owned by Html2rss::FeedPipeline; invoked only after StrategyPlan resolves :auto.
Hosted by the pipeline instance: session + extract call back into FeedPipeline.
Defined Under Namespace
Classes: AttemptState
Constant Summary collapse
- CHAIN =
Ordered list of concrete request strategies attempted by the :auto plan.
i[default botasaurus].freeze
- DETERMINISTIC_HTTP_STATUSES =
Deterministic HTTP statuses that indicate permanent failure rather than anti-bot challenges.
Set[400, 404, 410, 422, 451].freeze
- NON_FALLBACK_ERRORS =
Error classes that should abort auto fallback immediately.
[ RequestService::UnknownStrategy, RequestService::InvalidUrl, RequestService::UnsupportedUrlScheme, RequestService::RequestBudgetExceeded, RequestService::PrivateNetworkDenied, RequestService::CrossOriginFollowUpDenied, RequestService::ResponseTooLarge, RequestService::RedirectLimitReached ].freeze
Instance Method Summary collapse
-
#call ⇒ Html2rss::FeedPipeline::PipelineOutcome
Scrape-finished state for materialization.
- #initialize(strategies:, budget:, pipeline:, config:, resources:) ⇒ void constructor
Constructor Details
#initialize(strategies:, budget:, pipeline:, config:, resources:) ⇒ void
122 123 124 125 126 127 128 129 |
# File 'lib/html2rss/feed_pipeline/auto_fallback.rb', line 122 def initialize(strategies:, budget:, pipeline:, config:, resources:) @strategies = strategies @budget = budget @pipeline = pipeline @config = config @resources = resources @scrape_target = ScrapeTarget.from_config(config) end |
Instance Method Details
#call ⇒ Html2rss::FeedPipeline::PipelineOutcome
Returns scrape-finished state for materialization.
133 134 135 136 137 138 |
# File 'lib/html2rss/feed_pipeline/auto_fallback.rb', line 133 def call state = run_attempts return state.result if state.succeeded? finalize_failure(attempts: state.attempts, response: state.last_response) end |