¿Te resultó útil?
How to scrape Lidl
Technical engineer
Lidl US (lidl.com) is the American site of the discount grocery chain, and it shows every product with a price, a unit price, a pack size and, for deals, the old price and the Lidl Plus member price. If you track grocery prices, compare stores or follow weekly deals, that's the data you need.
Getting to it is easy. On 2026-11-05 a plain local run from a datacenter server, with no proxy, key or account, returned complete results, and no bot challenge has ever appeared on lidl.com in the project's tests. The catch is in the numbers. Prices depend on the store you pick, and the same gallon of whole milk costs $2.57 in one city and $5.09 in another. Unit prices are quoted in different units per store. And the product grid only loads in batches as you scroll.
This guide uses the open-source Lidl scraper from the 2scraper project. It reads searches, aisle and weekly-deals listings and single product pages from lidl.com and writes one row per product to JSON or CSV. The figures below come from the project's README, changelog and testing notes, each with the date it was measured.
What you get
You can start a run from:
| Input | Example | What it returns |
|---|---|---|
| A search | --query "whole milk" | Products for that search |
| An aisle | --category h/cheese-dairy-eggs/h10095761 | Every product in the aisle |
| A weekly-deals listing | --category aw42-fresh-deals/a10104750 | That week's deals, with old prices and Lidl Plus prices |
| A product page | --url "https://www.lidl.com/p/whole-milk/p11675058" | One product |
| Any lidl.com URL | --url "https://www.lidl.com/q/search?q=milk" | Whatever that listing shows |
Each product becomes one row:
| Field | What's in it |
|---|---|
| sku | Lidl's product ID, e.g. lidl-11675058 |
| title, brand, category | Product name, brand and Lidl's own category |
| price, currency | The price a shopper without the Lidl Plus app pays, in USD |
| unit_price, unit_price_per, unit_size | The price per unit, which unit it's quoted in, and the pack size, e.g. 0.03 per fl.oz. for 128 fl.oz. |
| original_price, discount_pct | The struck-through price and Lidl's discount badge, on deals |
| is_weekly_deal | Whether the product is a weekly deal |
| lidl_plus_price | The member price for Lidl Plus app users, where there is one |
| product_url, image_url | Product link and photo |
| store_id, zip_code | The store the run was priced at |
| price_source | Where the price came from: dom or embedded_json |
deal_valid_from and deal_valid_until are in the schema but stay empty. No tile states when a deal runs, and the dates printed on deals pages mostly belong to teasers for other weeks.
What you need
- Python 3.9 or newer.
- Playwright with Chromium, the recommended engine. Selenium and pyppeteer versions take exactly the same flags.
- One virtual environment per engine. Playwright and pyppeteer pin incompatible pyee versions, and pyppeteer clashes with Selenium on urllib3.
- Nothing paid. The default is a local headless Chromium with no proxy, key or account.
Installation
bash
git clone https://github.com/2scraper/lidl-scraper.git
cd lidl-scraper
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements-playwright.txt
playwright install chromium
cp .env.example .env
python3 env_config.py # shows which settings were loaded, without printing secrets
Leave .env empty for a first run. TWOCAPTCHA_KEY, LIDL_PROXY and LIDL_CDP_ENDPOINT go there later if you need them.
First run
bash
# A search, saved as JSON
python3 playwright_scraper.py --query "whole milk" --out lidl_results.json
# Priced at one store, by store number or by zip, with a result cap
python3 playwright_scraper.py --query "sourdough bread" --store-id US01449 --max-results 20
python3 playwright_scraper.py --query "sourdough bread" --zip 07086
# Cheapest first (also price_desc and newest)
python3 playwright_scraper.py --query milk --sort price_asc
# An aisle, or a weekly-deals listing, as a path copied from lidl.com's menu
python3 playwright_scraper.py --category h/cheese-dairy-eggs/h10095761 --max-results 200
python3 playwright_scraper.py --category aw42-fresh-deals/a10104750
# One product page
python3 playwright_scraper.py --url "https://www.lidl.com/p/whole-milk/p11675058"
Defaults are --max-results 30, --sort relevance, --format json and an output file called lidl_results.json (or .csv). --url can't be combined with --query or --category.
How the scraper works
Where the data is
lidl.com is built with Nuxt.js, and the search page's JSON-LD only describes the company, not the products. The real data sits in an attribute on every product tile, data-gridbox-impression: a small URL-encoded JSON with the ID, name, brand, category and price. The scraper reads that first, then takes the unit price and pack size from the price text shown on the tile. Product pages do have a clean schema.org Product block, but it carries only the public price, so the old price and the Lidl Plus price come from the page's price box instead.
Prices depend on the store
This is the most important thing about Lidl. With no store picked, a search returns default prices. Picking a store on the site sets four cookies (st, wh, zn and ar), and from then on prices change. On 2026-10-18 the same gallon of whole milk was:
| Store | Price |
|---|---|
| No store picked | $3.48 |
| Weehawken, NJ | $4.25 |
| Philadelphia, PA | $5.09 |
| Charlotte, NC | $2.57 |
--store-id (US01449 or just 1449) and --zip set those cookies in every engine. --zip picks the store in that zip code, or the numerically closest one sharing its first three digits, and logs which one it chose. Before the browser starts, the scraper looks the store up in Lidl's store API with the same public key the site's own store search uses. That lookup goes straight from your machine, not through --proxy or --cdp-endpoint. A store that doesn't exist is a usage error, and every row records the store actually used, so a run for zip 28202 shows up as store US01497 in Charlotte.
Unit prices change units too
unit_price_per tells you what unit the unit price is in, and it differs between stores. The same gallon is 0.03 per fl.oz. with no store and 1.06 per qt. at store US01449. So only compare unit prices where unit_price_per matches.
Lidl Plus and deals
price is always what a shopper without the Lidl Plus app pays. On a tile discounted only for members, price is the struck-through price and the member price goes into lidl_plus_price. On those tiles unit_price is empty, because Lidl prints only the member unit price there. On a public deal, original_price is the struck-through price and discount_pct is Lidl's own badge. On 2026-10-18 one weekly-deals listing returned 53 products, 18 with a public discount and 10 with a Lidl Plus price, every row with a photo.
The grid loads in batches
The product grid is both batched and virtualized: tiles appear in batches as you scroll and disappear again when they leave the screen. The scraper walks down the page one screen at a time so it can read every tile while it's visible, and clicks "View More Products" once the current batch has settled. It stops when it reaches --max-results, or when --stall-rounds scrolls in a row (4 by default) bring nothing new. There's no --pages flag, because there are no pages to number.
The page's own "N Products" counter is used as a check. If the run collected fewer than that number (or fewer than --max-results, if that's lower), it's marked partial with exit code 6 rather than passing as complete. On 2026-09-20, --query milk --max-results 60 returned 60 unique products in 11 scroll rounds, all with confirmed prices. An aisle run with --max-results 200 completed with 200 rows on 2026-10-18.
Blocks, captcha and paid options
lidl.com hasn't shown a bot challenge in any of the project's tests. On 2026-11-05 the default setup, with no proxy, key or account, was run from three places:
| Where the run came from | Result |
|---|---|
| A datacenter server (Hetzner, Helsinki) | complete, 20 products, all prices confirmed |
| A GitHub Actions runner | complete, 30 products |
| A US residential proxy, for comparison | complete, 20 products |
Datacenter addresses are the ones sites refuse most often, so a home connection wasn't tested separately. A weekly canary run (Mondays) keeps checking. One earlier canary run got lidl.com's home page instead of search results and exited 4, and the next run passed. If a search comes back empty, run it again with --dump-html before you believe the zero.
Because there's no captcha to solve, the local engines never pay for one. If a challenge ever appeared, the scraper would detect it and stop with exit code 3 without creating a paid task, since it has no way to put a token into a local page. Through the Browser API the remote browser solves challenges inside its own infrastructure, which works independently of that.
The paid tools are optional and buy volume, a specific exit country or a consistent device identity:
Proxies (--proxy, --proxy-file, or LIDL_PROXY in .env). Use an HTTP proxy: Chromium can't authenticate to a SOCKS proxy, so a socks5:// proxy with a login is refused up front. Selenium can't use a proxy with a password at all and strips the credentials with a warning. 2Captcha residential proxies have US exits; lists can be generated with the Proxy API. Remember that the store lookup doesn't go through the proxy.
2Captcha Browser API (--cdp-endpoint). Verified on 2026-10-18 with Playwright and pyppeteer from a US session: whole milk at store 1449 came back at $4.25, a 60-row milk search completed, and the weekly-favorites deals page returned the same 53 rows as a local run. A profile serves one session at a time and answers profile_locked for a few seconds after the previous one, which ends as exit 5, so leave a short gap between runs. Selenium refuses an endpoint with credentials.
Fingerprints (--fingerprint) apply a user agent from the Fingerprint API, with one operating-system tag in --fp-tags. The scraper deliberately applies only the user agent, not a locale or timezone, because the right field names for those couldn't be confirmed.
Output files and exit codes
Each run writes the results and a .meta.json sidecar with the status, stop_reason (max_results, stalled, max_scrolls, incomplete_grid and so on), the number of scroll rounds, failed rounds, the share of confirmed prices and the number of escaped CSV cells. An empty, blocked or failed run writes nothing, so it can't overwrite your last good file; --allow-empty changes that. The one exception is a parser failure: then a sidecar with stop_reason parser_found_nothing is written next to your untouched old output, because you'll want to know the scraper stopped understanding the page. Files are written atomically, and in the CSV cells starting with =, +, -, @, a tab or a line break get a leading apostrophe.
| Code | Meaning |
|---|---|
| 0 | Complete |
| 1 | Crash |
| 2 | Bad usage, e.g. a store that doesn't exist or a SOCKS proxy with a password |
| 3 | Blocked |
| 4 | Zero products, and nothing on the page says products exist |
| 5 | Content never obtained: a navigation failure, a Browser API error, an unreachable store API, or a page whose "N Products" counter shows products the parser couldn't read |
| 6 | Partial: some products came back, then something failed or the grid came up short |
Traps that look like bugs
- The same product has different prices in two runs. Check store_id. Prices are per store, and a run with no store uses default prices.
- Unit prices don't line up between runs. Check unit_price_per. One store quotes per fl.oz., another per qt.
- unit_price is empty on some deals. Those are Lidl Plus tiles, where Lidl prints only the member unit price.
- A search returns nothing at one store. On 2026-10-18 store US01575 (New York 10001) answered a whole milk search with a 404 and Lidl's no-match page. That run ends as exit 4, empty, not blocked. Without a store, the no-match page can also show a few unrelated products under its message; those are never returned as results.
- A --category path shows no products. Paths ending in /s… are often landing pages with no product grid. Aisles (h/…/h…) and weekly-deals listings (…/a…) are where Lidl lists products.
- pyppeteer won't start on an Apple Silicon Mac. It downloads an x86_64 Chromium. The scraper uses an installed Google Chrome there when PYPPETEER_EXECUTABLE_PATH isn't set.
Comparing runs
bash
python3 diff_runs.py milk_mon.json milk_tue.json --fail-on-change
diff_runs.py compares two runs by sku and reports added, removed and changed products. It refuses to compare runs that aren't both complete, and runs that didn't sample the same thing: a different query, category or sort, or a different store or zip. Grocery prices are regional, so a difference between two stores isn't a price change. A price difference that comes with a different price_source is reported separately as source_changed, and --fail-on-change ignores it. Prices are compared as numbers, so a JSON run and a CSV run of the same data come out as unchanged.
A sample row
The first row of the repository's sample_output.json, from the first live run on 2026-09-20 with no store picked:
json
{
"sku": "lidl-11675058",
"source": "lidl.com",
"category": "Food",
"title": "whole milk",
"brand": null,
"price": 3.3,
"currency": "USD",
"price_source": "dom",
"product_url": "https://www.lidl.com/p/whole-milk/p11675058",
"image_url": null,
"scraped_at": "2026-09-20T13:13:11Z",
"unit_price": 0.03,
"unit_price_per": "fl.oz.",
"unit_size": "128 fl.oz.",
"original_price": null,
"discount_pct": null,
"is_weekly_deal": null,
"lidl_plus_price": null,
"deal_valid_from": null,
"deal_valid_until": null,
"store_id": null,
"zip_code": null
}
Lidl's own gallon of whole milk at $3.30 with no store selected: 3.30 ÷ 128 rounds to $0.03 per fluid ounce. This sample predates the image and deal columns, which is why image_url is empty here; current runs fill it. store_id and zip_code are empty because no store was picked. By 2026-10-18 the same gallon cost $3.48 without a store.
Using the results: one basket, several stores
Since prices are per store, the most useful report compares the same products across stores. Run the same search for several zip codes:
bash
for zip in 07086 19103 28202; do
python3 playwright_scraper.py --query "whole milk" --zip $zip --max-results 20 --out milk_$zip.json
done
Then line the products up by sku:
python
import json
from pathlib import Path
stores, prices = [], {}
for path in sorted(Path(".").glob("milk_*.json")):
if path.name.endswith(".meta.json"):
continue
rows = json.loads(path.read_text(encoding="utf-8"))
if not rows:
continue
store = rows[0]["store_id"]
stores.append(store)
for r in rows:
prices.setdefault(r["sku"], {"title": r["title"]})[store] = r["price"]
print("Product".ljust(32) + "".join(s.rjust(10) for s in stores))
for sku, p in prices.items():
if all(s in p for s in stores):
print(p["title"][:31].ljust(32) + "".join(f"${p[s]:>8.2f}" for s in stores))
Only products found in every store are printed, so the comparison stays fair. If you want to compare unit prices instead, check that unit_price_per is the same in every column first.
Limitations
- Lidl US only (lidl.com), not the European Lidl sites.
- Deal start and end dates aren't available, so deal_valid_from and deal_valid_until stay empty.
- One search or listing per run; there's no parallel mode within a page.
- The store lookup runs from your own machine, even when you use a proxy or the Browser API.
- Selenium can't use a password-protected proxy or Browser API endpoint, and no engine can authenticate to a SOCKS proxy.
- No real bot-challenge page has been captured on lidl.com, so if one ever appears, its first run may need a manual check.
Common questions
Do I need a proxy or a key?
No. The default local run worked from a datacenter server and a GitHub runner with neither. Proxies and the Browser API help with volume or a specific exit country.
Why are my prices different from the website?
Probably a different store. Pick the same store with --store-id or --zip, or compare with a run that has no store.
Can I scrape Lidl in Germany or the UK?
Not with this scraper. It's built for lidl.com, the US site.
Why is there no --pages flag?
Because lidl.com has no numbered pages. The grid loads more products as you scroll, so the scraper uses --max-results and --stall-rounds instead.
Does it get Lidl Plus prices?
Yes, in lidl_plus_price, where Lidl shows one. price is always the price without the app.
Is it legal to scrape Lidl?
The scraper reads public pages, doesn't log in and doesn't place orders. Whether your use is allowed depends on your jurisdiction and Lidl's terms, so check both and keep a reasonable pace. This isn't legal advice.
Wrapping up
With Lidl the one thing to get right is the store. A price without a store_id is a price for nobody in particular, so pick a store for every run you plan to compare, and the rest of the data takes care of itself.
Getting started: clone the repository and run it locally with no setup. For volume or a specific exit country, sign up for 2Captcha and add residential proxies or the 2Captcha Browser API.
Source code
- Repository: github.com/2scraper/lidl-scraper (MIT)
- Project page: 2scraper.com/scrapers/lidl-scraper
- All scrapers: github.com/2scraper
Documentation
- Residential proxies and the Proxy API: US exits for volume.
- Browser API docs: CDP endpoint and profile options.
- Quick start: API key, first request, first result.
Related guides
- How to run the 2scraper open-source scrapers: setup, exit codes and access modes for every repository.
- How to scrape Rakuten: Japanese marketplace prices and points.
- How to scrape SHEIN: embedded page JSON and a check with image puzzles.
- How to scrape Catawiki: auction lots, bids and estimates, and why headless fails.
- How to scrape Flippa: online businesses for sale, asking prices and profit multiples.