# Loot South Africa Scraper (`crawlerbros/loot-south-africa-scraper`) Actor

Scrape Loot (loot.co.za) - a leading South African online marketplace covering books, electronics, toys, baby, fashion, home & kitchen, games, DVDs and more. Search products, browse by department/category, look up exact products by code/URL, and list the full category taxonomy.

- **URL**: https://apify.com/crawlerbros/loot-south-africa-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** E-commerce, Automation, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Loot South Africa Scraper

Scrape [Loot](https://www.loot.co.za) — a leading South African online marketplace covering books, electronics, computers, toys, baby products, fashion, kitchen & home, games, DVDs, sport & outdoor, stationery, health & beauty and licensed merchandise. Search products, browse any of the site's 20 departments and their subcategories, look up exact products by code or URL, or list the full category taxonomy. HTTP-only via the store's own public JSON API. No login, no proxy, no cookies you have to supply.

### What this actor does

- **Four modes:** `search`, `byCategory`, `byProductCodes`, `listCategories`
- **Search** across the whole marketplace or scoped to a department, with server-side price/stock/special filtering plus client-side brand/keyword refinement
- **Category browse** across all 20 top-level departments (Books, Electronics, Baby, Toys, Fashion, Kitchen & Home, Games, DVD, Blu-Ray, Sport, Outdoor, Stationery, Health & Beauty, Music, DIY, Arts & Crafts, Licensed Merchandise, Deals, Promotions) plus any subcategory via an exact code override
- **Filters:** min/max price, in-stock only, on-special only, brand, sort order
- **Rich product data:** price, list-price/discount, stock/availability, rating, seller, full image gallery, plain-text description, bullet features, and a structured `specifications` block (grouped spec tables — e.g. Display/Power/Ports for electronics, Authors/ISBN/Format for books)
- Empty fields are omitted — no `null`/`""`/`[]` ever shipped

### Output per product

- `productId`, `title`, `fullTitle`, `subtitle`, `slug`, `itemType`
- `brand`, `category`
- `price`, `currency` (`ZAR`)
- `listPrice`, `discountPercent` — when the product is on special
- `availability`, `availabilityMessage`, `inStock`, `shipsForFree`
- `availableQuantity` — units currently in local stock (`0` can still mean orderable from the supplier — see `availability`)
- `itemsLeftOnDeal` — units left on a limited-time deal (only present when the deal has a visible countdown)
- `minLeadTimeDays`, `actualLeadTimeDays` — estimated shipping lead time in working days
- `nonReturnable`, `groupOffer` — return-policy and bundle-offer flags
- `payflexAvailable`, `payJustNowAvailable` — buy-now-pay-later payment options
- `monthlyRepayment`, `repaymentInterestRate` — installment financing terms (when offered)
- `rating`, `ratingCount`
- `barcode`, `seller`
- `mainImage`, `images[]`
- `description`, `features[]`
- `specifications` — nested `{group: {key: value}}`, e.g. `{"Display": {"Screen Size": "15.6\"", ...}, "General": {"Authors": "J. K. Rowling", "ISBN-13": "978-...", ...}}`
- `relatedProductIds[]` — codes of related/recommended products (mode=byProductCodes only, where the full product-detail response is fetched)
- `reviews[]` — approved customer reviews (mode=byProductCodes only): `{reviewId, title, text, rating, reviewer, date}`
- `sourceUrl`
- `recordType: "product"`, `scrapedAt`

### Output per category (`mode=listCategories`)

- `categoryCode`, `name`, `parentCode`, `parentName`
- `sourceUrl`, `browseUrl`
- `recordType: "category"`, `scrapedAt`

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `mode` | string | `search` | `search` / `byCategory` / `byProductCodes` / `listCategories` |
| `searchQuery` | string | `harry potter` | Free-text query (mode=search) |
| `categoryCode` | string | `qb` (Books) | Curated department dropdown (mode=byCategory) |
| `customCategoryCode` | string | – | Exact category code for any subcategory; overrides the dropdown |
| `productCodes` | array | – | Product codes or full product URLs (mode=byProductCodes) |
| `minPrice` / `maxPrice` | number | – | Price range in ZAR |
| `inStockOnly` | bool | `false` | Only in-stock products |
| `onSpecialOnly` | bool | `false` | Only discounted products |
| `brand` | string | – | Case-insensitive brand substring match |
| `keyword` | string | – | Case-insensitive substring match against title/brand/description — extra refinement on any mode |
| `sortBy` | string | `relevance` | `relevance` / `priceAsc` / `priceDesc` / `titleAsc` / `titleDesc` / `ratingDesc` |
| `includeSubCategories` | bool | `true` | Also fetch each department's subcategories (mode=listCategories) |
| `maxItems` | int | `50` | Hard cap (1–1000) |

#### Example: search with price + stock filters

```json
{
  "mode": "search",
  "searchQuery": "wireless earphones",
  "minPrice": 200,
  "maxPrice": 1500,
  "inStockOnly": true,
  "sortBy": "priceAsc",
  "maxItems": 40
}
```

#### Example: browse a department

```json
{
  "mode": "byCategory",
  "categoryCode": "jgj",
  "onSpecialOnly": true,
  "sortBy": "priceDesc",
  "maxItems": 50
}
```

#### Example: search, refined further by a client-side keyword filter

```json
{
  "mode": "search",
  "searchQuery": "wizard",
  "keyword": "potter",
  "maxItems": 50
}
```

#### Example: browse a subcategory not in the curated dropdown

```json
{
  "mode": "byCategory",
  "customCategoryCode": "hgz",
  "maxItems": 50
}
```

#### Example: lookup exact products

```json
{
  "mode": "byProductCodes",
  "productCodes": [
    "cwxj-7974-g400",
    "https://www.loot.co.za/product/hermione-granger-wizard-wand/pxml-4917-g790"
  ]
}
```

#### Example: list the category taxonomy

```json
{
  "mode": "listCategories",
  "includeSubCategories": true,
  "maxItems": 200
}
```

### Use cases

- **Price monitoring** — track book, electronics and toy prices on South Africa's biggest general marketplace
- **Competitor / market research** — benchmark a South African e-commerce catalogue, pricing and specials
- **Product feed building** — import books, electronics or gifts into a comparison site or marketplace
- **Stock availability tracking** — flag when a popular item goes out of stock
- **Category / taxonomy analysis** — enumerate every department and subcategory

### FAQ

**Do I need a proxy or login?**  No. Loot issues a short-lived anonymous access token to every visitor automatically (the same mechanism your browser gets when you load the site) — the actor fetches this token itself at the start of each run. No signup, API key or user-supplied cookie is required.

**What currency are prices in?**  ZAR (South African Rand).

**What's `discountPercent`?**  Computed from `listPrice` (the pre-discount price) vs the current `price`, only present when the product is genuinely on special.

**What's inside `specifications`?**  Loot groups technical/bibliographic details differently per product type — electronics get groups like Display/Power/Ports/Physical Specification, books get General (Authors, ISBN-13, Format, Pages, Imprint), etc. The actor preserves this grouping rather than flattening everything into one bucket.

**How do I browse a category that isn't in the dropdown?**  Set `customCategoryCode` to the exact code from a `loot.co.za` search link (`?cat=<code>`) or from a `mode=listCategories` run — it overrides the dropdown.

**Why does `sortBy` sometimes only sort within a candidate pool rather than the whole category?**  The actor fetches a bounded pool of matching products (5x `maxItems`, up to 200+) and sorts that pool itself, since the store's own sort parameter isn't reliably honored for every value. For very large categories with a small `maxItems`, increase `maxItems` if you need a true full-category top/bottom ranking.

**Why did my `keyword` filter on `byCategory` return 0 results even though matching products exist in that category?**  Same root cause as `sortBy` above: `byCategory` has no server-side text search, so the actor's own default browse ordering for very large categories (millions of items for broad departments like Books) may not surface a niche keyword match within the fetched candidate pool. `keyword` is most reliable combined with `mode=search` (which does a real server-side text search first) or with a narrower `customCategoryCode` subcategory.

**How fresh is the data?**  Real-time — every request hits the live storefront's own API.

# Actor input Schema

## `mode` (type: `string`):

What to fetch.

## `searchQuery` (type: `string`):

Free-text query matched against product title, brand and description.

## `categoryCode` (type: `string`):

Pick a top-level department. Choose "(custom — use field below)" to browse any subcategory by exact code (see mode=listCategories for the full list).

## `customCategoryCode` (type: `string`):

Exact category code (from a loot.co.za `cat=` search link, or from mode=listCategories output). Overrides the dropdown above when set.

## `productCodes` (type: `array`):

Loot product codes (e.g. `cwxj-7974-g400`) or full product URLs (`loot.co.za/product/<slug>/<code>`).

## `minPrice` (type: `number`):

Drop products priced below this (search/byCategory/byProductCodes).

## `maxPrice` (type: `number`):

Drop products priced above this.

## `inStockOnly` (type: `boolean`):

Only emit products currently in stock.

## `onSpecialOnly` (type: `boolean`):

Only emit products currently discounted (has a list price above the current price).

## `brand` (type: `string`):

Case-insensitive substring match against the product's brand.

## `keyword` (type: `string`):

Client-side case-insensitive substring match against title, brand and description — an extra refinement layer on top of any mode. Most reliable combined with mode=search (a real server-side text search); on byCategory it only filters the fetched candidate pool, so very large/broad categories may need a narrower customCategoryCode to surface a niche keyword.

## `sortBy` (type: `string`):

Result ordering, applied by the actor after fetching a candidate pool (the store's own sort parameter is unreliable for several values).

## `includeSubCategories` (type: `boolean`):

Also fetch and emit each department's direct subcategories (one extra request per department), not just the 19 top-level departments.

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

Hard cap on emitted records.

## Actor input object example

```json
{
  "mode": "search",
  "searchQuery": "harry potter",
  "categoryCode": "qb",
  "productCodes": [],
  "inStockOnly": false,
  "onSpecialOnly": false,
  "sortBy": "relevance",
  "includeSubCategories": true,
  "maxItems": 50
}
```

# Actor output Schema

## `items` (type: `string`):

Dataset containing all scraped Loot products/categories.

# 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 = {
    "mode": "search",
    "searchQuery": "harry potter",
    "categoryCode": "qb",
    "productCodes": [],
    "inStockOnly": false,
    "onSpecialOnly": false,
    "sortBy": "relevance",
    "includeSubCategories": true,
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/loot-south-africa-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 = {
    "mode": "search",
    "searchQuery": "harry potter",
    "categoryCode": "qb",
    "productCodes": [],
    "inStockOnly": False,
    "onSpecialOnly": False,
    "sortBy": "relevance",
    "includeSubCategories": True,
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlerbros/loot-south-africa-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 '{
  "mode": "search",
  "searchQuery": "harry potter",
  "categoryCode": "qb",
  "productCodes": [],
  "inStockOnly": false,
  "onSpecialOnly": false,
  "sortBy": "relevance",
  "includeSubCategories": true,
  "maxItems": 50
}' |
apify call crawlerbros/loot-south-africa-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,crawlerbros/loot-south-africa-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/DX0yZM8t0usQIgxc1/builds/D8MYvLzH6HsJDEXPj/openapi.json
