# Dia ES - Product prices (`scrapingbuddy/dia-es-products`) Actor

Scrapes products and prices from the Dia online supermarket (dia.es) by search term or category.

- **URL**: https://apify.com/scrapingbuddy/dia-es-products.md
- **Developed by:** [Giacomo Pigani](https://apify.com/scrapingbuddy) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Dia Scraper

Scrapes products and prices from [Dia's online supermarket](https://www.dia.es).
You can search the same way as on the website, or download every product in a category.

### Input

Set a search term or a category, not both: like on the website, Dia's search can't be limited to
a category.

| Parameter | Options | Description |
|---|---|---|
| `searchTerm` | (optional) Text to search for | One search, like the search box on the website. Returns the same products, in the same order, as the website. |
| `category` | (optional) Category code, e.g. `L105`, or a category page URL | Every product in this category or subcategory. In a URL only the code after `/c/` matters, so `https://www.dia.es/frutas/c/L105` and `https://www.dia.es/anything/c/L105` are the same category. |

Example using a search query:

```json
{
  "searchTerm": "leche condensada"
}
```

Example using a category (a pasted category URL works too):

```json
{
  "category": "https://www.dia.es/cervezas-vinos-y-licores/vino-tinto/c/L2120"
}
```

#### Categories

The top-level categories and their codes. A subcategory's code is the one after `/c/` in its URL
on the website, e.g. `L2120` in `/cervezas-vinos-y-licores/vino-tinto/c/L2120`.

| Code | Category |
|------|----------|
| L124 | Navidad (seasonal) |
| L128 | Novedades y recomendados |
| L105 | Frutas |
| L104 | Verduras |
| L102 | Carnes |
| L103 | Pescados y mariscos |
| L134 | Charcutería |
| L101 | Quesos |
| L108 | Huevos, leche y mantequilla |
| L112 | Panadería |
| L113 | Yogures y postres |
| L119 | Congelados y helados |
| L106 | Arroz, pastas y legumbres |
| L107 | Aceites, salsas y especias |
| L114 | Conservas, caldos y cremas |
| L109 | Café, cacao e infusiones |
| L132 | Bollería, repostería y azúcar |
| L111 | Galletas, cereales y mermeladas |
| L110 | Chocolates y golosinas |
| L116 | Platos preparados y pizzas |
| L115 | Aperitivos y frutos secos |
| L117 | Agua y refrescos |
| L127 | Zumos y smoothies |
| L118 | Cervezas, vinos y licores |
| L122 | Limpieza y hogar |
| L129 | Higiene y cuidado del cuerpo |
| L130 | Cabello y perfumería |
| L131 | Salud y parafarmacia |
| L120 | Infantil |
| L123 | Mascotas |

### Output

- **Dataset**: one item per product, as Dia returns it, with the page and image links made
  absolute. Search results also carry `search_term`. A product appears only once per run, even
  when it is in more than one subcategory.
- **`FAILED_REQUESTS`** (key-value store, only when some requests failed): the URL and error
  of each failed page. If any page failed, the run fails rather than returning an incomplete
  dataset as a success.

Prices are the ones the website shows before you choose a delivery address.

#### Product fields

Values come as Dia sends them. Fields inside an object are written with a dot, e.g.
`prices.price`. Dia sends a few fields only in search results or only in category listings.

| Field | Description |
|---|---|
| `sku_id` | Product code, as in the product page URL. |
| `display_name` | Name with size, e.g. *Leche condensada Dia Láctea 1 Kg*. |
| `brand` | Brand. Missing for loose produce. |
| `url`, `image` | Product page and main image. |
| `prices.price` | Price in EUR. |
| `prices.price_per_unit`, `prices.measure_unit` | Unit price in EUR, and its unit, e.g. `KILO`, `LITRO`, `UNIDAD`. |
| `prices.strikethrough_price`, `prices.discount_percentage` | Price before the discount (the same as `price` when there is none) and the discount in percent. |
| `prices.is_promo_price`, `prices.is_club_price` | The price is a promotion; the price is for Club Dia members only. |
| `promotions`, `headband_promotion` | Active promotions, and the promotion banner on the product card. |
| `stamp_description` | Badge on the product card, e.g. *Mejor valorado*, *Novedad*. |
| `units_in_stock` | Units in stock. |
| `weight_in_grams`, `average_weight` | Category rows, products sold by weight: grams per unit and average weight of one piece. |
| `l1_category_description`, `l2_category_description` | Search rows only: category and subcategory names. |
| `dia_brand`, `brand_type` | Search rows only: Dia's own brand, and the brand type code (`D` = Dia). |
| `allergens`, `product_info` | Search rows only: dietary labels, e.g. *Sin lactosa*. |
| `search_term` | Search rows only: the search that returned the product. |

# Actor input Schema

## `searchTerm` (type: `string`):

One search, like the search box on the Dia website, e.g. "leche condensada". Returns the same products, in the same order, as the website. Leave empty to scrape a category instead.

## `category` (type: `string`):

A Dia category or subcategory: its code, e.g. L105 (Frutas), or a category page URL from the website, e.g. https://www.dia.es/frutas/c/L105. Only the code after /c/ matters. Scrapes every product in it.

## Actor input object example

```json
{
  "searchTerm": "leche condensada"
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchTerm": "leche condensada"
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapingbuddy/dia-es-products").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "searchTerm": "leche condensada" }

# Run the Actor and wait for it to finish
run = client.actor("scrapingbuddy/dia-es-products").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchTerm": "leche condensada"
}' |
apify call scrapingbuddy/dia-es-products --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapingbuddy/dia-es-products"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/NaUa0iWiCDpvEQdw1/builds/dlhXv0mxMmhWboXA6/openapi.json
