Preparing search index...

    Interface for recipe source providers

    Defines the contract that all recipe providers must implement to support bulk recipe import from external websites.

    interface RecipeProvider {
        id: string;
        name: string;
        logoUrl: string;
        supportedLanguages?: readonly string[];
        getBaseUrl(): Promise<string>;
        discoverRecipeUrls(
            options: DiscoveryOptions,
        ): AsyncGenerator<DiscoveryProgress>;
        parseSelectedRecipes(
            selectedRecipes: DiscoveredRecipe[],
            options: DiscoveryOptions,
        ): AsyncGenerator<ParsingProgress>;
        fetchRecipe(
            url: string,
            defaultPersons: number,
            ignoredPatterns: IgnoredIngredientPatterns,
            signal?: AbortSignal,
        ): Promise<FetchedRecipe>;
        fetchImageUrlForRecipe(
            url: string,
            signal: AbortSignal,
        ): Promise<null | string>;
        canHandleUrl(url: string): boolean;
    }

    Implemented by

    Index

    Properties

    id: string

    Unique identifier for this provider (e.g., 'hellofresh')

    name: string

    Human-readable display name shown in the UI

    logoUrl: string

    URL to the provider's logo image

    supportedLanguages?: readonly string[]

    Languages this provider supports. If undefined, available for all languages.

    Methods

    • Returns the base URL for this provider, resolved from the user's locale

      Returns Promise<string>

      Promise resolving to the provider's base URL

    • Fetches and parses a single recipe from its URL

      Parameters

      • url: string

        URL of the recipe page to fetch

      • defaultPersons: number

        Default serving size if not specified in the recipe

      • ignoredPatterns: IgnoredIngredientPatterns

        Patterns for ingredients to skip during parsing

      • Optionalsignal: AbortSignal

        Optional abort signal for cancellation

      Returns Promise<FetchedRecipe>

      Promise resolving to the fetched and converted recipe

      Error if the recipe cannot be fetched or parsed

    • Fetches just the image URL for a recipe page on-demand

      Used for visibility-based lazy loading of images. Returns null if no image is found or the fetch fails.

      Parameters

      • url: string

        Recipe page URL to fetch image for

      • signal: AbortSignal

        Abort signal for cancellation

      Returns Promise<null | string>

      Promise resolving to image URL or null

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

      Used to find the correct provider for a recipe URL without calling any async methods. Implementations should check URL prefixes against their known base URL(s).

      Parameters

      • url: string

        Recipe source URL to test

      Returns boolean

      true if this provider owns the URL