Preparing search index...

    Class BaseRecipeProviderAbstract

    Abstract base class for recipe providers

    Implements the RecipeProvider interface with common functionality for discovering recipe URLs and identifying provider ownership. Subclasses must implement provider-specific URL extraction and may override extractImageFromHtml when they have a faster path than the default scraper-based extraction performed by useRecipeScraper.

    Hierarchy (View Summary)

    Implements

    Index
    id: string

    Unique identifier for this provider

    name: string

    Display name for this provider

    logoUrl: string

    URL to the provider's logo image

    • Discovers all recipe category URLs from the provider

      Parameters

      • baseUrl: string

        The provider's base URL

      • Optionalsignal: AbortSignal

        Optional abort signal for cancellation

      Returns Promise<string[]>

      Promise resolving to array of category page URLs

    • Extracts recipe links from an HTML page

      Parameters

      • html: string

        Raw HTML content of a page

      Returns { url: string; title?: string; imageUrl?: string }[]

      Array of discovered recipe links with optional title and image

    • Returns true if this provider can handle the given recipe source URL

      Default implementation returns false. Subclasses should override to check whether the URL belongs to their domain.

      Parameters

      • _url: string

        Recipe source URL to test

      Returns boolean

      false by default

    • Extracts a real image URL directly from page HTML, without invoking the recipe scraper.

      Default implementation returns null, signalling the caller (typically useRecipeScraper) to fall back to the scraper-based image. Subclasses may override when they have a cheaper or more reliable path (for example, Quitoque returns a placeholder via the scraper but exposes the real image in JSON-LD schema markup).

      Parameters

      • _html: string

        Raw HTML content of the recipe page

      Returns string | null

      Image URL when found via the provider-specific path, otherwise null

    • Fetches HTML content from a URL with timeout handling

      Parameters

      • url: string

        URL to fetch

      • Optionalsignal: AbortSignal

        Optional abort signal for cancellation

      Returns Promise<string>

      Promise resolving to the HTML content

      Error if request fails or times out

    • Delays execution for rate limiting

      Parameters

      • ms: number

        Milliseconds to delay

      Returns Promise<void>

      Promise that resolves after the delay

    • Fetches a batch of category pages concurrently

      Parameters

      • urls: string[]
      • signal: AbortSignal | undefined

      Returns Promise<PromiseSettledResult<CategoryResult>[]>

    • Processes results from a batch of category page fetches

      Parameters

      • results: PromiseSettledResult<CategoryResult>[]
      • batch: string[]
      • state: DiscoveryState
      • batchStartIndex: number
      • maxRecipes: number | undefined

      Returns void

    • Adds discovered recipe links to state, avoiding duplicates

      Parameters

      • links: { url: string; title?: string; imageUrl?: string }[]
      • state: DiscoveryState
      • maxRecipes: number | undefined

      Returns void

    • Retries empty pages that appeared before the last successful page (likely rate-limited)

      Parameters

      • categoryUrls: string[]
      • state: DiscoveryState
      • maxRecipes: number | undefined
      • signal: AbortSignal | undefined

      Returns Promise<void>

    • Executes a single retry attempt for failed pages

      Parameters

      • pagesToRetry: string[]
      • state: DiscoveryState
      • maxRecipes: number | undefined
      • signal: AbortSignal | undefined
      • attempt: number

      Returns Promise<string[]>

    • Combines two abort signals into one

      Creates a new abort signal that triggers when either input signal aborts.

      Parameters

      • signal1: AbortSignal

        First abort signal

      • signal2: AbortSignal

        Second abort signal

      Returns AbortSignal

      Combined abort signal