Danish Grocery Deals (Tilbudsavis) + ntfy.sh
Weekly scraper for Danish supermarket tilbudsaviser (Lidl, Rema 1000, Netto, Meny, 365 discount) that pushes only the genuinely cheap "wow" deals to your phone via ntfy.sh, plus a full organized deal list as a file attachment.
What it does
- Reads the weekly digital aviser of 5 Danish chains via the Tjek API (the platform behind etilbudsavis.dk and the stores' own aviser)
- Picks the current/upcoming weekly catalog per store, paginates all offers
- Extracts weight, per-kg / per-l / per-piece prices and discount %
- Keeps only "wow" deals: interest matches below a per-category price bar, or any deal with >= 40% discount, capped at 18 items
- Publishes to ntfy.sh: the wow summary + the full list as an attachment (full list ordered by supermarket, then by category)
- Dedupes per day so re-runs don't spam
Files
scripts/tilbudsavis.pyscraper (Tjek API, metrics, wow filter, full list)scripts/notify.pypublisher (runs scraper, pushes to ntfy.sh)templates/config.jsonstores, interests, wow thresholds, ntfy settingstemplates/deals-notify.service/.timersystemd weekly schedule
Setup
- Copy
templates/config.jsonnext to the two scripts (same directory). - Fill in the config:
api_key: Tjek API browser key (see "Tjek API notes" below)ntfy.topic: your ntfy.sh topic (use a random suffix for privacy)stores: dealer ids for chains (defaults cover the 5 Danish chains)interests: keyword lists, exclude lists, and wow thresholds
- Test:
python3 tilbudsavis.pyprints the summary between markers - Notify:
python3 notify.pyruns the scraper and pushes to ntfy.sh - Schedule weekly (Sunday morning, when all new aviser are out):
systemd timer (see templates) or
0 9 * * 0cron
Config reference
{
"api_key": "YOUR_TJEK_API_KEY",
"api_base": "https://squid-api.tjek.com",
"ntfy": { "url": "https://ntfy.sh", "topic": "tilbudsavis-RANDOM", "token": "" },
"stores": [
{ "id": "71c90", "name": "Lidl", "avis_url": "https://etilbudsavis.dk/Lidl" },
{ "id": "11deC", "name": "Rema 1000", "avis_url": "https://etilbudsavis.dk/REMA-1000" },
{ "id": "9ba51", "name": "Netto", "avis_url": "https://etilbudsavis.dk/Netto" },
{ "id": "267e1m", "name": "Meny", "avis_url": "https://etilbudsavis.dk/MENY" },
{ "id": "DWZE1w", "name": "365 discount", "avis_url": "https://etilbudsavis.dk/365discount" }
],
"interests": [
{
"category": "Oksekod",
"emoji": "🥩",
"keywords": ["oksekod", "bøf", "steak", "mørbrad", ...],
"exclude": ["steak fries", "pommes"],
"wow": { "max_price_per_kg": 60, "min_discount_pct": 40 }
}
]
}
Wow filter per interest
max_price_per_kg/max_price_per_l/max_price_per_piece: keep deal if unit price is at or below this barmin_discount_pct: keep deal if discount vs "før" price is >= this- Any deal with >= 40% discount also qualifies for the general wow section
- Cap:
MAX_WOW_ITEMS = 18,MAX_PER_INTEREST = 4(edit in tilbudsavis.py)
Tjek API notes (gotchas)
- Catalogs:
GET /v2/catalogs?dealer_id=<id>(camelCaseretailerIdis IGNORED) - Offers:
GET /v2/offers?catalog_id=<id>&limit=100&offset=<n>(max limit 100, paginate by offset; filter results client-side bycatalog_id) - Dealer ids (DK): Lidl
71c90, Rema 100011deC, Netto9ba51, Meny267e1m, 365 discountDWZE1w. Discover others viaGET /v2/dealers?country=DK&limit=200&page=N - The browser API key is embedded in etilbudsavis.dk's JS bundle
(
assets/entry-client-*.js, look forapiKey:{browser:...}); it is a public read key, no account needed - Avis weeklies: Lidl/Rema start Sunday, Netto Saturday, Meny/365 Thursday. Run Sunday morning to catch all five
ntfy.sh notes
- Message limit is 4096 bytes;
notify.pychunks longer text automatically (titles get " (1/2)" suffixes) - Attachments (full deal list) must POST to
https://ntfy.sh/<topic>with aFilename:header; posting to the root path fails with 413 - Public topics: use a random topic suffix, or set
ntfy.tokento a ntfy.sh access token and the script adds an Authorization header
Troubleshooting
HTTP 400on catalogs: you usedretailerIdinstead ofdealer_idHTTP 400/500on offers: limit > 100, orcatalogId(camelCase) instead ofcatalog_idHTTP 413on attachment: file > ntfy.sh limit, or wrong URL path- Empty wow list: thresholds too strict (raise
max_price_per_kgor lowermin_discount_pct), or the week has no standout deals
