# Marks & Spencer Product Scraper (`bovi/marks-scraper`) Actor

Collect Marks & Spencer product records from public search/listing pages. Get IDs, titles, prices, ratings, variants, and stock indicators. Run with queries or M\&S URLs; no sign-in. Pricing: Free: $0.01 per dataset item + $0.00005 per Actor start.

- **URL**: https://apify.com/bovi/marks-scraper.md
- **Developed by:** [Vitalii Bondarev](https://apify.com/bovi) (community)
- **Categories:** E-commerce, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 marks & spencer product scrapers

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

## Marks & Spencer Product Scraper

Extract product records from public search results and listing pages on [marksandspencer.com](https://www.marksandspencer.com), including IDs, prices, ratings, variants, images and stock indicators. The Actor reads embedded page data and does not require an account or sign-in.

- Scrape public M\&S search and listing pages using search terms, URLs, or both.
- Monitor product prices and previous prices across distinct product records.
- Research catalog structure with product IDs, brands, categories, labels and product URLs.
- Compare ratings, review counts, variants, images and stock indicators for product analysis.
- Deduplicate repeated products across searches and supplied URLs.

### What you get

The Actor reads product data embedded in public M\&S pages. A field is omitted from the record when the page does not supply it.

| Field or family | Type | Description |
|---|---|---|
| `product_id` | string | M\&S product ID. Omitted when the page does not supply it. |
| `product_external_id` | string | External product identifier. Omitted when the page does not supply it. |
| `title` | string | Product name. |
| `brand` | string | Product brand. Omitted when the page does not supply it. |
| `category` | string | Product category or product definition. Omitted when the page does not supply it. |
| `url` | string | Product URL on marksandspencer.com. |
| `price` | number | Current product price extracted from the page. Omitted when the page does not supply it. |
| `currency` | string | Currency associated with `price`. Omitted when the page does not supply it. |
| `previous_price` | number | Previous price when supplied by the page. Omitted when the page does not supply it. |
| `rating` | number | Product average rating when supplied. Omitted when the page does not supply it. |
| `review_count` | integer | Total review count when supplied. Omitted when the page does not supply it. |
| `image_urls` | array of strings | Product image URLs found on the listing or search page. Omitted when the page does not supply it. |
| `variants` | array of objects | Colour and size variants, including `colour`, `size`, `sku`, `upc` and variant `price` when present. Omitted when the page does not supply it. |
| `labels` | array of objects | Product labels with a `name` and associated string `values`. Omitted when the page does not supply it. |
| `stock_indicator` | string | The site's stock-level indicator when supplied. Omitted when the page does not supply it. |
| `online_only` | boolean | Whether the page marks the product as online only. Omitted when the page does not supply it. |
| `is_ranged` | boolean | Whether the page marks the product as ranged. Omitted when the page does not supply it. |
| `scraped_at` | ISO 8601 string | UTC timestamp generated when the record is created; not empty on returned records. |

### Sample output

This sample is shortened by omitting the record's `image_urls`, `variants` and `scraped_at` fields. The values shown are copied from one real dataset record.

```json
{
  "product_id": "61218892",
  "product_external_id": "P60744571",
  "title": "Pure Cashmere Crew Neck Jumper",
  "brand": "Autograph",
  "category": "Jumpers",
  "url": "https://www.marksandspencer.com/pure-cashmere-crew-neck-jumper/p/clp60744571?color=NIGHTSHADE&image=SD_03_T30_4140A_Q5_X_EC_90",
  "price": 99,
  "currency": "GBP",
  "rating": 4.466216216216216,
  "review_count": 148,
  "stock_indicator": "M",
  "online_only": false,
  "is_ranged": false
}
```

### Pricing

The live billing model is **pay per event**.

You pay only for the events listed below. This Actor does not use the Pay per event + usage option, so the platform usage of your runs (compute, proxy traffic and storage) is not billed to you separately.

| Event | What it covers | Free-plan price |
|---|---|---:|
| `apify-actor-start` | Charged when the Actor starts, once per GB of run memory, with a minimum of one event. | $0.00005 per event |
| `apify-default-dataset-item` | One scraped result with all fields. | $0.01 per event |

On the Free plan, 10 results = $0.10005; 1,000 results = 1,000 × $0.01 + $0.00005 = $10.00005; and 10,000 results = 10,000 × $0.01 + $0.00005 = $100.00005. These examples use one minimum start event.

Apify Free plan includes **$5 of monthly platform usage credit**. The $5 monthly Free-plan credit covers 499 results in one run.

### How to use

1. **Open** the Actor in your Apify account and create a run.
2. **Enter** one or more product search terms in `queries`, such as `cashmere jumper`.
3. **Add** M\&S category, product listing or search result pages in `urls` when you want to collect from supplied pages. The two inputs can be combined.
4. **Set** `maxResults` to the maximum number of distinct product records to return.
5. **Start** the run and inspect the dataset. The Actor follows available result pages, deduplicates repeated products, and stops when it reaches `maxResults`.
6. **Repeat** the run through Apify Schedules; daily is a suitable starting point for monitoring listings or prices.

```json
{
  "queries": [
    "cashmere jumper"
  ],
  "maxResults": 10
}
```

Export the dataset as JSON or CSV, or read it through the Apify dataset API.

### Input parameters

| Parameter | What it does | Default |
|---|---|---|
| `queries` | Array of product search terms for marksandspencer.com. Each non-empty query is searched separately. | — |
| `urls` | Optional array of M\&S category, product listing or search result URLs. Only valid `marksandspencer.com` or its subdomain URLs are used. | — |
| `maxResults` | Integer limit for distinct product records across all queries and URLs. The minimum accepted value is 1. A value that cannot be read as an integer falls back to 50. | `50` |
| `proxyConfiguration` | Apify proxy configuration. If proxy is disabled or not supplied, the Actor connects directly. | Apify Proxy, `RESIDENTIAL` group |

### Limits and edge cases

| Condition | What the buyer sees | What to do |
|---|---|---|
| No non-empty `queries` and no valid `urls` are supplied | The Actor logs `Provide at least one M&S search query or listing URL` and returns without collecting records. | Supply at least one search term or valid M\&S URL. |
| A supplied URL is not a `marksandspencer.com` URL, or contains a username or password | The URL is ignored and a warning is logged for a non-M\&S URL. | Use a URL whose host is `marksandspencer.com` or a subdomain, without embedded credentials. |
| `maxResults` is zero or negative | The Actor logs that `maxResults` must be greater than zero and returns without collecting records. | Use an integer of at least `1`. |
| A product is repeated across searches or supplied URLs | The repeated product is skipped, so the dataset can contain fewer items than the number of matching cards. | Add more relevant queries or URLs if you need more distinct products. |
| The run reaches `maxResults` | The Actor stops after the configured number of distinct records, even if more products or pages remain. | Increase `maxResults` for a larger collection. |
| A source has more than 100 result pages available | The Actor processes no more than 100 pages for that source. | Use additional relevant M\&S source URLs or narrower searches if the required products are beyond that range. |
| A fetched page produces no product cards in the expected embedded data | The Actor logs `No product cards found` and stops processing that source. | Check that the URL is an M\&S search or listing page and try the run again. |
| A page fetch raises an error | The fetch operation makes up to three attempts. If it still raises an error, the Actor logs a warning and stops processing the current source. | Check the source URL and run again. Records already pushed before that source error remain in the dataset. |
| A source page does not provide an optional value | The corresponding field, such as `previous_price`, `image_urls` or `labels`, is omitted from that record. | Treat source-derived optional fields as conditional and use the fields present in each record. |

### FAQ

#### How much does it cost to scrape Marks & Spencer products?

See the Pricing section.

#### Why did my run return no products?

See Limits and edge cases for the conditions that produce an empty or short dataset and for the log messages to check.

#### Why is the Actor not working for one of my pages?

See Limits and edge cases for what happens when a page fails to load or has no product cards.

#### Is scraping public Marks & Spencer data legal or allowed?

The Actor accesses public search results and product listing pages on marksandspencer.com and does not require an account or sign-in. Source terms and applicable law depend on the buyer's use case, so review the relevant source terms and legal requirements for your intended use; this Actor does not provide a legal guarantee.

### Related actors

- [Casas Bahia Scraper](https://apify.com/bovi/casasbahia-scraper) — related retail product collection with prices and specifications.
- [Cashify Scraper](https://apify.com/bovi/cashify-scraper) — related product data collection focused on refurbished phone prices and stock.
- [AutoScout24 Cars Scraper](https://apify.com/bovi/autoscout24-cars-scraper) — related price and specification collection for vehicle listings.

### Usage statistics

This Actor creates a small, content-free summary at the end of each run, used only to monitor reliability and improve this Actor. No input values, credentials or scraped data are sent.

A copy of the exact record for your run is saved as `USAGE_STATS` in your own Apify key-value store.

To opt out, set `disableUsageStats` to `true` in the input. Nothing is sent then.

[Full list of collected fields](https://api.apify.com/v2/key-value-stores/v9rgHjMKLDGtHf8tD/records/index.html)

# Actor input Schema

## `queries` (type: `array`):

Product search terms for marksandspencer.com. Each query is searched separately.

## `urls` (type: `array`):

Optional Marks & Spencer category, product listing, or search result URLs.

## `maxResults` (type: `integer`):

Maximum number of distinct product records to return across all queries and URLs.

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

Optional Apify proxy configuration. Leave disabled to connect directly.

## Actor input object example

```json
{
  "queries": [
    "cashmere jumper"
  ],
  "maxResults": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `products` (type: `string`):

Structured product records with prices, ratings, images, variants, labels, and stock indicators.

# 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 = {
    "queries": [
        "cashmere jumper"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("bovi/marks-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 = {
    "queries": ["cashmere jumper"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("bovi/marks-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 '{
  "queries": [
    "cashmere jumper"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call bovi/marks-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,bovi/marks-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/pSJqhkAb4f4Vxxu8U/builds/CSnKt8R75twUaJ7WE/openapi.json
