No description
Find a file
2026-03-04 10:37:56 +01:00
.gitignore Ignore .env 2026-02-23 23:26:45 +01:00
README.md feat: Add --force-pdf option to re-download PDFs and automatically link ingredients to instructions based on text matching. 2026-02-24 13:41:45 +01:00
recipe_urls.txt add recipies 2026-03-04 10:37:31 +01:00
requirements.txt feat: Implement persistent HTTP sessions for Mealie API calls and add environment variable support. 2026-02-24 13:15:18 +01:00
test_output.txt feat: Implement persistent HTTP sessions for Mealie API calls and add environment variable support. 2026-02-24 13:15:18 +01:00
thermomix_urls.txt add recipies 2026-03-04 10:37:31 +01:00
web_extractor.py Extract country information and add flag for thermomix recipes 2026-03-04 10:37:56 +01:00

HelloFresh to Mealie Importer

A robust tool to extract recipe data from HelloFresh and hfresh.info URLs and import them directly into your Mealie instance as high-quality, local-asset-only recipes.

Features

  • Idempotent Imports: Run the same URL multiple times without creating duplicates or redundant image uploads.
  • hfresh.info Support: Automatically resolves hfresh.info short links to the full recipe and original PDF.
  • Local Media: Downloads images and PDFs locally then uploads them to Mealie. No reliance on external CDNs for your recipe views.
  • Entity Matching: Automatically matches HelloFresh ingredients, units, and tools with your existing Mealie database.
  • Smart Formatting: Fixes German umlauts and uses Mealie's native <img> tagging for beautiful step-by-step instructions.

Installation

  1. Create a Python virtual environment:

    python3 -m venv venv
    source venv/bin/activate
    
  2. Install dependencies:

    pip install -r requirements.txt
    

Configuration

The script uses environment variables for authentication with your Mealie instance. You can set them in your shell or create a .env file in the project root:

MEALIE_URL="https://mealie.your-domain.org"
MEALIE_TOKEN="your-api-token"

To generate a token: User Settings → API Tokens → Generate.

Usage

Single Recipe

python web_extractor.py "https://hfresh.info/de-DE/recipes/..."

Batch Import

Create a file e.g., recipe_urls.txt with one URL per line:

python web_extractor.py recipe_urls.txt

Flags

  • --refresh-cache: Re-fetches the list of foods/units/tools from Mealie. Useful if you've added many new items manually in the Mealie UI.
  • --force-images: Re-uploads all images and PDFs even if the recipe already exists.
  • --force-pdf: Re-downloads the PDF to local disk even if the recipe already exists (does not re-upload).

How it works

  1. Extraction: Scrapes the HelloFresh page (or resolves an hfresh.info page) to get raw JSON data.
  2. Matching: Resolves ingredients, tools, and units against your Mealie cache. If it doesn't find a match, it creates a new entity.
  3. Idempotency: Checks if a recipe with that name already exists. If found, it updates metadata (ingredients, steps text, times) but skips image/PDF uploads to save bandwidth and storage.
  4. Finalization: Construction of a clean PATCH payload that avoids Mealie's internal slug-conflict errors.