Exception: Html2rss::AutoSource::Scraper::NoScraperFound

Inherits:
Error
  • Object
show all
Defined in:
lib/html2rss/auto_source/scraper.rb

Overview

Error raised when no suitable scraper is found.

Constant Summary collapse

CATEGORY_MESSAGES =

Surface diagnostics shared with NoFeedItemsExtracted (one string home).

{
  blocked_surface: 'blocked surface likely (anti-bot or interstitial). ' \
                   'Target a direct listing URL, configure BOTASAURUS_SCRAPER_URL, ' \
                   'or run from an environment that can complete anti-bot checks.',
  app_shell: 'app-shell surface detected (client-rendered page with little or no ' \
             'server-rendered article HTML). Configure BOTASAURUS_SCRAPER_URL or target a direct ' \
             'listing/update URL instead of a homepage or shell entrypoint.',
  unsupported_surface: 'unsupported extraction surface for auto mode. ' \
                       'Try a direct listing/changelog/category URL, ' \
                       'or use explicit selectors in a feed config.'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, category: :unsupported_surface) ⇒ NoScraperFound

Returns a new instance of NoScraperFound.

Parameters:

  • message (String, nil) (defaults to: nil)

    custom error message override

  • category (Symbol) (defaults to: :unsupported_surface)

    no-scraper classification



59
60
61
62
63
# File 'lib/html2rss/auto_source/scraper.rb', line 59

def initialize(message = nil, category: :unsupported_surface)
  validate_category!(category)
  @category = category
  super(message || "No scrapers found: #{CATEGORY_MESSAGES.fetch(@category)}")
end

Instance Attribute Details

#categoryObject (readonly)

Returns the value of attribute category.



65
66
67
# File 'lib/html2rss/auto_source/scraper.rb', line 65

def category
  @category
end