# Labirint Book Price & Stock Monitor (`sashaebashu/labirint-monitor`) Actor

Scrape & monitor the Labirint (labirint.ru) book catalogue by genre, series or publisher — title, publisher, series, genre, price, list price, discount % and availability — with price & stock change-tracking between runs.

- **URL**: https://apify.com/sashaebashu/labirint-monitor.md
- **Developed by:** [Sasha Ebashu](https://apify.com/sashaebashu) (community)
- **Categories:** E-commerce, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.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/platform/actors/running/actors-in-store#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

## Labirint Book Price & Stock Monitor

Scrapes the **Labirint** book catalogue (labirint.ru) by genre, series or publisher — title, price,
publisher's list price, availability and genre — and tracks how prices and stock change between runs.

### What you get

One row per book:

`store`, `productId`, `name`, `publisher`, `series`, `genre`, **`price`**, **`listPrice`**,
**`discountPercent`**, `currency`, `available`, `url`, `categoryPath`, `scrapedAt`

**`price` vs `listPrice`:** Labirint shows two numbers on every book — the publisher's list price
and its own selling price, typically about half. `price` is what a customer pays and `listPrice` is
the crossed-out number. This is Labirint's permanent pricing display, **not** a temporary promo, so
`discountPercent` describes the shop's standing markdown rather than a sale that will end.

`series` is only present for books that belong to one, which is roughly 40% of a typical listing.
There is no author field — Labirint does not expose one on listing pages.

#### Monitor mode

Each row also gets `changeType`, `previousPrice`, `priceLow30`, `priceHigh30`, `firstSeenAt`,
`lastConfirmedAt`.

| `changeType` | Means |
|---|---|
| `new` | First time this book was seen in this scope |
| `price_up` / `price_down` | The selling price moved |
| `stock_change` | Availability flipped |
| `out_of_stock` | Was in the listing before and has now vanished from it |
| `unchanged` | Nothing moved |

`out_of_stock` is reported **once** (carrying the book's last known title, URL and price), then
dropped from the snapshot. It is **skipped** whenever the run did not cover every listing in full —
cut short by the time budget, the cost cap, `Max results`, or a listing that returned nothing —
because then "missing" would just mean "not reached". The log says so when that happens.

### Input

| Field | What it does |
|---|---|
| **Listing URLs** | Any Labirint listing: a genre (`https://www.labirint.ru/genres/2308/`), a series, a publisher page, or a filtered listing. Query strings are preserved. |
| **Max pages per listing** | The Actor stops on its own when a listing stops yielding new books. |
| **Max results** | Global cap. 0 = no limit. |
| **Max concurrency** | Parallel listing requests. Labirint is slow, so keep this modest. |
| **Monitor mode / Output only changed** | Change-tracking, described above. |

### Notes & limits

- **Use the default residential RU proxy.** This is not a preference — measured twice: over a
  datacenter proxy labirint.ru timed out on 3 of 8 requests in one test and on all 8 in another, and
  when it *did* answer it served a reduced card markup with no selling price and no availability. An
  early build defaulting to datacenter reported the list price as the selling price on 95 of 98 rows.
  Over residential the same listing returns all fields on every card, and about 10x faster.
- **Listing pages repeat a few titles** in a "Бестселлеры жанра" carousel above the grid, so the same
  book can appear twice in the HTML. Rows are deduplicated by book id — you are never billed twice
  for the same book.
- **End of pagination is detected by content.** Past the last page Labirint keeps serving a valid
  listing rather than a 404, so the crawl stops when a page adds no new book ids.
- The Actor honours your **Maximum cost per run**: it stops when the cap is reached and says so.
- If a listing yields nothing, it is reported in the log and saved to the `EMPTY_CATEGORIES` record
  rather than passing silently.

# Actor input Schema

## `categoryUrls` (type: `array`):

Labirint listings to scrape — a genre (https://www.labirint.ru/genres/2308/), a series, a publisher page, or any filtered listing. Paste the URL straight from your browser; query strings are kept.

## `maxPagesPerCategory` (type: `integer`):

The Actor stops earlier by itself when a listing runs out of new books.

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

Stop after this many books in total. 0 = no limit.

## `maxConcurrency` (type: `integer`):

Parallel listing requests. Labirint is slow to answer, so keep this modest.

## `monitorMode` (type: `boolean`):

Compare against the previous run for the SAME listings and label every row: new / price\_up / price\_down / stock\_change / out\_of\_stock / unchanged, plus previous price, 30-day low & high and first-seen / last-confirmed stamps.

## `onlyChanges` (type: `boolean`):

Monitor mode only — drop the `unchanged` rows so you pay for and read only what moved.

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

IMPORTANT: keep the default (Apify Proxy, RESIDENTIAL, country RU). Over datacenter proxies labirint.ru times out often and, when it does answer, serves cards without the selling price or availability.

## Actor input object example

```json
{
  "categoryUrls": [
    "https://www.labirint.ru/genres/2308/"
  ],
  "maxPagesPerCategory": 10,
  "maxItems": 0,
  "maxConcurrency": 4,
  "monitorMode": false,
  "onlyChanges": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "RU"
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `changes` (type: `string`):

No description

## `details` (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 = {
    "categoryUrls": [
        "https://www.labirint.ru/genres/2308/"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "RU"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("sashaebashu/labirint-monitor").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 = {
    "categoryUrls": ["https://www.labirint.ru/genres/2308/"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "RU",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("sashaebashu/labirint-monitor").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 '{
  "categoryUrls": [
    "https://www.labirint.ru/genres/2308/"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "RU"
  }
}' |
apify call sashaebashu/labirint-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,sashaebashu/labirint-monitor"
        }
    }
}

```

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/ZTDRqPlvj5Umd7QYe/builds/wyhXvVULtGjy5sYqG/openapi.json
