No description
- Python 100%
| .gitignore | ||
| README.md | ||
| recipe_urls.txt | ||
| requirements.txt | ||
| test_output.txt | ||
| thermomix_urls.txt | ||
| web_extractor.py | ||
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.infoSupport: Automatically resolveshfresh.infoshort 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
-
Create a Python virtual environment:
python3 -m venv venv source venv/bin/activate -
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
- Extraction: Scrapes the HelloFresh page (or resolves an
hfresh.infopage) to get raw JSON data. - Matching: Resolves ingredients, tools, and units against your Mealie cache. If it doesn't find a match, it creates a new entity.
- 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.
- Finalization: Construction of a clean
PATCHpayload that avoids Mealie's internal slug-conflict errors.