# H\&M Scraper (`datascrapers/h-and-m-scraper`) Actor

Scrape H\&M products from search queries, search URLs, and category URLs, with optional product details.

- **URL**: https://apify.com/datascrapers/h-and-m-scraper.md
- **Developed by:** [Data Scrapers](https://apify.com/datascrapers) (community)
- **Security:** Limited permissions
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.20 / 1,000 products

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

**H\&M Scraper** creates a structured dataset of apparel products collected from H\&M. Each dataset item is one article and can include the article id, name, price, currency, discount, color, sizes, availability, and product URL. Query the source with search terms or H\&M category and product URLs, choose a locale such as `de_de`, optionally add the description and composition, limit results with `maxItems`, and retrieve records through the Apify Dataset API or export them as JSON, CSV, Excel, XML, or another supported format.

[![H\&M Scraper — input to structured data](https://raw.githubusercontent.com/faizanalii/apify-actor-assets/main/h-and-m-scraper/h-and-m-scraper-value-demo.gif)](https://apify.com/datascrapers/h-and-m-scraper)

### Dataset at a glance

| Property | Value |
|---|---|
| Source | H\&M |
| Record unit | One article |
| Input methods | `searchQueries`, `startUrls`, `locale` |
| Main identifiers | `articleId`, `url` |
| Delivery | Apify Dataset and API |
| Export formats | JSON, CSV, Excel, XML, and other Apify dataset exports |
| Update model | Fresh records per Actor run |
| Pricing | $1.50 per 1,000 products on the Free plan |

### Coverage and available records

`searchQueries` runs against the market in `locale`, for example `de_de` or `en_us`. `startUrls` accepts H\&M search, category, and product URLs. The locale in the URL path selects the market for that URL, so a `de_de` category URL stays on the German site even if `locale` is different.

`includeProductDetails` adds description and composition when the product page is fetched. `detailConcurrency` sets how many detail pages are requested at once. `maxItems` caps articles.

Each saved row is one `articleId`. Color variants can be separate articles. The Actor does not collect account wish lists or checkout data.

### Data dictionary

| Field | Type | Nullable | Description | Example |
|---|---|---:|---|---|
| articleId | string | No | Article id used for deduplication | 1345672001 |
| productName | string | No | Product name | Jacke mit Schaldetail |
| price | number | Yes | Current price | 37.5 |
| currency | string | Yes | Currency | EUR |
| formattedPrice | string | Yes | Display price | 37,50 € |
| percentageDiscount | string | Yes | Discount label | -25% |
| colorName | string | Yes | Color on a color-variant row | Weinrot |
| url | string | No | Product URL | https://www2.hm.com/de_de/productpage.1345672001.html |
| sourceQuery | string | Yes | Search that found the article | jackets |
| details | object | Yes | Description and composition when details are on | {"description": "Kurze, oversized Jacke..."} |

### Example dataset record

```json
{
  "articleId": "1345672001",
  "productName": "Jacke mit Schaldetail",
  "price": 37.5,
  "currency": "EUR",
  "formattedPrice": "37,50 €",
  "percentageDiscount": "-25%",
  "url": "https://www2.hm.com/de_de/productpage.1345672001.html",
  "sourceQuery": "jackets",
  "details": {
    "description": "Kurze, oversized Jacke aus weichem Filzmaterial mit einem abnehmbaren, langen Schal.",
    "compositions": ["Obermaterial: Polyester 100%", "Futter: Polyester 100%"]
  }
}
```

### Query and input reference

| Field | Required | Description |
|---|---|---|
| searchQueries | No | Search terms, such as `jackets` |
| startUrls | No | H\&M search, category, or product URLs |
| locale | No | Market for search queries, such as `de_de` or `en_us` |
| includeProductDetails | No | Fetch description and composition and charge `product-details` |
| detailConcurrency | No | Parallel product-page requests |
| maxItems | No | Maximum articles |
| proxyConfiguration | No | Apify proxy settings |

Provide a search term or a start URL.

### Retrieve the data through the API

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")
run = client.actor("datascrapers/h-and-m-scraper").call(run_input={
    "searchQueries": ["jackets"],
    "locale": "de_de",
    "includeProductDetails": True,
    "maxItems": 5,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["productName"], item["price"], item["articleId"])
```

### Data quality and record handling

Deduplicate on `articleId`. `url` is a second key. `details` is present only after a successful product page. A failed detail request is not charged. `sourceQuery` separates articles when one run contains several searches. Each run writes a new dataset.

### Pricing and cost examples

Pay per event. Prices are per 1,000 events. Platinum and Diamond use the Gold rate. Platform usage is not billed separately.

| Event | Free | Bronze | Silver | Gold |
|---|---:|---:|---:|---:|
| product | $1.50 | $1.40 | $1.30 | $1.20 |
| product-details | $2.50 | $2.40 | $2.30 | $2.20 |

A Free-plan run that saves 1,000 articles costs $1.50. Adding details for those articles costs $2.50 more. Leave `includeProductDetails` off when you only need price and URL.

### Limitations and responsible data use

Search uses `locale`. URLs use the locale in the path. Prices and sizes change with the live catalog. Collect public product fields only, and keep `maxItems` small on the first run.

### Dataset questions

#### What is one dataset item?

One H\&M article, identified by `articleId`.

#### When is product-details charged?

When `includeProductDetails` is on and the product page is fetched.

#### Which field should I use to merge runs?

`articleId` or `url`.

### Related datasets from Data Scrapers

- [Calvin Klein Scraper](https://apify.com/datascrapers/calvinklein-scraper) for apparel
- [MediaMarkt Scraper](https://apify.com/datascrapers/mediamarkt-de-scraper) for retail products
- [Cdiscount Scraper](https://apify.com/datascrapers/cdiscount-scraper) for retail catalogs
- [Back Market Scraper](https://apify.com/datascrapers/backmarket-scraper) for refurbished products

### Data Scrapers support

Questions about this dataset: stardustspotlight@gmail.com.

# Actor input Schema

## `startUrls` (type: `array`):

H\&M search, category, or product URLs. A search URL looks like https://www2.hm.com/de_de/search-results.html?q=jackets. A category URL looks like https://www2.hm.com/de_de/herren/neuheiten/alle-anzeigen.html. The locale in the path (de_de, en_us) selects the market.

## `searchQueries` (type: `array`):

Product search terms, for example jackets or linen shirt. Uses the Locale field. You can combine these with start URLs.

## `locale` (type: `string`):

Market for search queries, for example de_de or en_us. Category, search, and product URLs use the locale in the URL instead.

## `includeProductDetails` (type: `boolean`):

Fetch description, composition, colours, and materials for each product. Charged as a product-details event in addition to the product event. Detail requests run in parallel and share one proxy. A browser is used only when the product page requires cookies.

## `detailConcurrency` (type: `integer`):

How many product detail requests to run at once when Include Product Details is enabled. They share one proxy session.

## `maxItems` (type: `integer`):

Maximum number of products to scrape. Use 0 for no limit.

## `proxyConfiguration` (type: `object`):

Proxy settings. Residential proxies are recommended. Product details keep one proxy for the whole session.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www2.hm.com/de_de/herren/neuheiten/alle-anzeigen.html"
    }
  ],
  "searchQueries": [
    "jackets"
  ],
  "locale": "de_de",
  "includeProductDetails": false,
  "detailConcurrency": 5,
  "maxItems": 10,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

Dataset of H\&M products

## `runStats` (type: `string`):

Product counts and timestamps for this run

# 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 = {
    "startUrls": [
        {
            "url": "https://www2.hm.com/de_de/herren/neuheiten/alle-anzeigen.html"
        }
    ],
    "searchQueries": [
        "jackets"
    ],
    "locale": "de_de",
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("datascrapers/h-and-m-scraper").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 = {
    "startUrls": [{ "url": "https://www2.hm.com/de_de/herren/neuheiten/alle-anzeigen.html" }],
    "searchQueries": ["jackets"],
    "locale": "de_de",
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("datascrapers/h-and-m-scraper").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 '{
  "startUrls": [
    {
      "url": "https://www2.hm.com/de_de/herren/neuheiten/alle-anzeigen.html"
    }
  ],
  "searchQueries": [
    "jackets"
  ],
  "locale": "de_de",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call datascrapers/h-and-m-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,datascrapers/h-and-m-scraper"
        }
    }
}
```

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/1esJqeVWIVqLyIRu7/builds/VBdbODItGanAUEoyW/openapi.json
