DEV Community

Cover image for How to Pull ALDI Australia Products into Python with ALDI Scraper
ReventaData
ReventaData

Posted on Originally published at apify.com

How to Pull ALDI Australia Products into Python with ALDI Scraper

A supermarket search page shows brand, pack size, price and a unit comparison price for every product, but only one page at a time. To keep those numbers in a spreadsheet you copy them by hand. This tutorial replaces that with a short Python script. It runs one search phrase on the ALDI Australia site and returns one row per product.

The tool is the ALDI Australia Scraper Actor (reventadata/aldi-au-scraper). You call it from Python with the official apify-client package. The Actor reads public pages and needs no login. It is not affiliated with ALDI Australia or ALDI.

By the end you will have a script that runs one search, saves the rows to a JSON file and turns them into a CSV file.


Prerequisites

  1. Python 3.11 or newer.
  2. The Apify API client for Python:
pip install -U "apify-client~=3.0"
Enter fullscreen mode Exit fullscreen mode
  1. An Apify account and your personal API token, set as an environment variable:
export APIFY_API_TOKEN="your_apify_token_here"
Enter fullscreen mode Exit fullscreen mode

The Actor needs no login. The token is only for the call from your script.


What you'll achieve

Each row is one product from the search results. The fields are:

  • id: the product id of the listing.
  • title: the product title.
  • url: the link to the product page.
  • brand: the brand published on the tile.
  • size: the pack size published on the tile.
  • price: the price as published, a text value.
  • comparisonPrice: the unit comparison price as published, a text value.
  • matchedQuery: the phrase that produced the listing.
  • scrapedAt: an ISO 8601 timestamp of when the row was stored.

Example use case: search a phrase such as Chocolate and keep the brand, size and comparison price of each product in a file, then run the same search another day and compare the two files by scrapedAt.


Step 1: Open the Actor

Open the ALDI Australia Scraper page on the Apify Store to read its description. This guide calls the Actor from Python, so the ID you need is reventadata/aldi-au-scraper.


Step 2: Set the inputs

Field Type What it does
query string Required. The product phrase to look up in the ALDI Australia public search, for example Chocolate.
maxItems integer Maximum number of results to save to the dataset. Minimum 1. Default 25.

query decides what is searched. maxItems decides when the Actor stops saving rows. A small value such as 10 is a good first test, because you can read every row.


Step 3: Run it from Python

import json
import os

from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_API_TOKEN"])

run_input = {"query": "Chocolate", "maxItems": 10}

run = client.actor("reventadata/aldi-au-scraper").call(run_input=run_input)
if run is None:
    raise SystemExit("The run did not start.")

print("Run status:", run.status)
items = client.dataset(run.default_dataset_id).list_items().items

for item in items:
    print(item["title"], "|", item["brand"], "|", item["size"], "|", item["price"], "|", item["comparisonPrice"])

with open("aldi-chocolate-rows.json", "w", encoding="utf-8") as f:
    json.dump(items, f, indent=2, ensure_ascii=False)
Enter fullscreen mode Exit fullscreen mode

The call method starts the Actor and waits for it to finish. The run object has a status and the ID of the dataset that stores the rows. list_items().items returns the rows as a list of dictionaries. The loop prints one line per product and the last lines save every row to aldi-chocolate-rows.json.

If the run did not start, call returns nothing, and the script stops with a message instead of failing later on an empty value.


Step 4: Read one row

The three rows below are the first three of the example run of 2026-11-27 (input {"query": "Chocolate", "maxItems": 10}, 10 rows in total). They are shown whole and unedited, except that the dollar sign inside each price text is written as the JSON escape \u0024, which any JSON parser reads back as the same character.

[
  {
    "id": "000000000705176001",
    "title": "Milk Chocolate & Caramel Biscuit Chocolate 100g",
    "url": "https://www.aldi.com.au/product/moser-roth-milk-chocolate-caramel-biscuit-chocolate-100g-000000000705176001",
    "brand": "MOSER ROTH",
    "size": "100 g",
    "price": "\u00243.29",
    "comparisonPrice": "(\u00243.29 per 100 g)",
    "matchedQuery": "Chocolate",
    "scrapedAt": "2026-11-27T15:35:00.294179+00:00"
  },
  {
    "id": "000000000705176002",
    "title": "White Chocolate & Coconut Mango Chocolate 100g",
    "url": "https://www.aldi.com.au/product/moser-roth-white-chocolate-coconut-mango-chocolate-100g-000000000705176002",
    "brand": "MOSER ROTH",
    "size": "100 g",
    "price": "\u00243.29",
    "comparisonPrice": "(\u00243.29 per 100 g)",
    "matchedQuery": "Chocolate",
    "scrapedAt": "2026-11-27T15:35:00.294179+00:00"
  },
  {
    "id": "000000000403695001",
    "title": "Chocolate Coated Bites Dark Chocolate Mint 150g",
    "url": "https://www.aldi.com.au/product/nougat-limar-chocolate-coated-bites-dark-chocolate-mint-150g-000000000403695001",
    "brand": "NOUGAT LIMAR",
    "size": "150 g",
    "price": "\u00244.99",
    "comparisonPrice": "(\u00243.33 per 100 g)",
    "matchedQuery": "Chocolate",
    "scrapedAt": "2026-11-27T15:35:00.294179+00:00"
  }
]
Enter fullscreen mode Exit fullscreen mode

Notes on the fields:

  • The price and comparisonPrice values are text exactly as the site published them, so parse them yourself if you need numbers.
  • matchedQuery repeats the phrase you searched.
  • scrapedAt is a UTC timestamp. Every row of one run carries the same value in the example above.
  • id identifies the product, and url links to its page.

Understanding your results

A row is a copy of what the site shows on one product tile: a title, a brand, a pack size, a price and a unit comparison price. Nothing in the row is calculated by the Actor. That has two consequences.

First, price and comparisonPrice are strings. The comparison text in the example rows has brackets, a price and a unit such as per 100 g inside one value. If you want to sort by unit price, parse that text yourself and decide how to treat rows whose text has another shape.

Third, nothing is converted. The title, the brand and the size arrive as the site wrote them, so apply your own clean-up if you want, for example, a size in a single unit.

Second, a row only holds what the tile published. A field can be empty when the tile does not show it, so read fields with item.get("name") in code that must not stop on a missing value.


Pro tips and advanced usage

  • Save a CSV. The second script reads the JSON file back and writes a CSV with the columns you choose:
import csv
import json

with open("aldi-chocolate-rows.json", encoding="utf-8") as f:
    items = json.load(f)

columns = ["id", "title", "brand", "size", "price", "comparisonPrice", "matchedQuery", "scrapedAt", "url"]
with open("aldi-chocolate-rows.csv", "w", newline="", encoding="utf-8") as f:
    writer = csv.DictWriter(f, fieldnames=columns)
    writer.writeheader()
    for item in items:
        writer.writerow({name: item.get(name) for name in columns})
Enter fullscreen mode Exit fullscreen mode
  • Keep one file per day. Put the date in the file name and compare files later with scrapedAt.
  • Try several phrases. Run the script once per phrase. matchedQuery tells you which phrase produced each row when you merge the files.
  • Start small. Keep maxItems low until the first rows look right, then raise it.
  • Dedupe on id. A product can appear under two phrases when you merge files, so key merged data by id.

Limits to know

  • Each public search page held 30 product tiles when measured on 2026-11-27. The Actor reads further pages until maxItems is reached.
  • A phrase with no matching results stores no rows.
  • query is required and can be at most 120 characters. maxItems must be 1 or more.
  • Only public fields are returned. Nothing sits behind a login.
  • The same product id is stored once per run.

Troubleshooting common issues

  • The run stops with a message and no rows: check that query is not empty and is within 120 characters, and that maxItems is at least 1.
  • The run succeeds with no rows: the phrase matched nothing. Try a broader phrase.
  • The run fails with a message about the site: the site refused the run. Wait and run it again. The run log shows the message the Actor wrote.
  • A row shows an empty field: the tile did not publish it. Read it with item.get("name") as shown above.
  • The status is not a success: read the run log in the Apify Console. The Actor writes the reason there.

Next steps

Run the script on a schedule with your own cron job or a scheduler, keep the files, and compare them across dates. Try other phrases and a larger maxItems. The Apify Python client documentation covers the rest of the client.

For current pricing and details, see the Store page.

About the author: reventadata builds and publishes data extraction Actors on the Apify Store.

Top comments (0)