# Website Change & Price Monitor (No Browser) (`leadharbor/page-change-price-monitor`) Actor

Check up to 500 public web pages per run and see what changed since the last run: added and removed text lines, plus old price, new price and percent change. Plain HTTP at 512 MB, no browser. Pay per page checked; failed pages are not charged.

- **URL**: https://apify.com/leadharbor/page-change-price-monitor.md
- **Developed by:** [Mohammed Samaan](https://apify.com/leadharbor) (community)
- **Categories:** E-commerce, Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 page checkeds

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

### Page Change and Price Monitor

Watch public web pages for changes in their text and price. Each run fetches every page and compares it with the copy saved by the previous run under the same monitor name. You get back:

- **What changed**: text lines added and removed (up to 50 of each by default).
- **Price changes**: old price, new price, change and percent, with currency when the page states it.
- **New pages** are saved as a baseline on their first check.

Built for schedules: run it daily or hourly with the same **Monitor name** and you only see what moved.

#### Why this one

- **No browser, no proxy.** Plain HTTP, 512 MB. Up to 500 pages per run, 5 fetched at a time by default.
- **Price read from the page itself**: your CSS selector first, then schema.org product data (JSON-LD), then price meta tags. Handles `1.299,00 €`, `$1,299.00`, `OMR 12.500`, `0,999` and Arabic-Indic digits. On sale markup the `<ins>` price wins and struck-through `<del>`/`<s>` prices are skipped.
- **Noise control**: watch only one part of the page (`selector`), strip dates or counters with `ignorePatterns`, or set `reportOn` to `price` to list price changes only.
- **Failed pages are free** and never overwrite the saved copy, so the next good run still compares with the last good one.

#### Input example

```json
{
  "urls": [
    { "url": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html", "label": "book", "priceSelector": ".price_color", "selector": ".product_main" },
    "https://example.com/"
  ],
  "monitorName": "competitor-prices",
  "reportOn": "any"
}
```

#### Output row (changed price, example values)

```json
{ "status": "changed", "changeType": "price+text", "label": "book", "priceBefore": 51.77, "price": 45.5, "priceChange": -6.27, "priceChangePercent": -12.11, "currency": "GBP", "addedLines": ["£45.50"], "removedLines": ["£51.77"] }
```

`status` is `baseline` (first check), `changed`, `unchanged` (listed only when **Only list changed pages** is off) or `error`. When pages were checked and none has anything to list, the run writes one free `summary` row (`pagesChecked`, `changed`, `unchanged`, `message`) so the result is never empty. Every page row has `charged` (true or false), `truncated` (the page was over 1 MB and only the first 1 MB was compared) and `linesTruncated` (the text was over 5,000 lines). A run summary is saved as `SUMMARY` in the run's key-value store.

#### Pricing

Pay per event: **page checked**, charged once for every page that was fetched, compared and saved, changed or not. Pages that fail before that are not charged: timeout, HTTP error, not an HTML page, selector not found, selector too slow, ignore-pattern time limit, private address, or an internal error during the check.

One rare case is charged: the check finished and was paid for, but the result row could not be written to the dataset. That row is reported as an error with `charged: true`, and the run summary counts it under "charged but not delivered".

#### robots.txt and the hosts this actor contacts

- **robots.txt is checked first (default on).** Before each page is fetched, the actor reads that site's `/robots.txt` and applies the rules for its user agent `PageChangeMonitor` (else `*`), following RFC 9309. A page whose rules disallow it is not fetched: you get an error row with `robotsBlocked: true` and an explanation, and **it is not charged** and no saved state changes. A robots.txt that cannot be read (server error, 429, timeout) also skips the page, as the standard requires. Other 4xx answers (such as 404) mean the site has no rules.
- **Redirects:** each hop is checked against the robots.txt of the host it points to before it is requested.
- **User agent:** `Mozilla/5.0 (compatible; PageChangeMonitor/0.1; Apify actor)`.
- **Hosts contacted:** only the hosts of the URLs you list (their `/robots.txt` and the page itself) and any host a redirect leads to. No third-party APIs, no proxy, no browser.
- **Switch:** set `respectRobots` to `false` to turn the check off. The run logs a warning and you are responsible for having permission to fetch the pages.

#### Limits

- Pages that need a login, cookies or JavaScript to show their content cannot be read. Only public pages are fetched; private and local network addresses are refused.
- The price is not detected when a page has no price element, product data or price meta tag; pass `priceSelector` in that case.
- A lone `$` is not turned into a currency code (it could be USD, CAD, AUD and others); currency stays empty unless the page names it.
- Text order moves are not reported; only lines that appeared or disappeared.
- Pages are read as UTF-8.
- **Size caps.** Only the first 1 MB of each page is compared (cut on a character boundary, row flag `truncated`). Only the first 5,000 lines of text are compared (row flag `linesTruncated`); changes further down are not seen. Lines longer than 500 characters are split into pieces of up to 500 characters (at a space where possible), so a change shows as the piece that contains it. Timeout per page is 5 to 15 seconds.
- **Ignore patterns use RE2 syntax** (the safe subset of regular expressions: no backreferences such as `\1`, no lookarounds such as `(?=...)`, repeat counts up to 1,000); an unsupported pattern is refused at the start with the field named. All patterns together may use 20 seconds per run; after that, remaining pages are reported as errors and not charged.
- **Selectors**: at most 4 pseudo-classes and 8 combinators; `:has` is not allowed inside `:has` or `:not`; a selector cannot be HTML. A selector that takes 2 seconds or more on one page makes that page an error (not charged); the time is measured after the selector finishes, so one page can still take a few seconds. All selectors together may use 30 seconds per run, then pages with selectors are reported as errors without being evaluated.
- **Price rules.** Exactly one number must be left in the price text; text such as `Qty 1 19.99` or two prices without sale markup gives no price (`priceSource: "selector-ambiguous"`) rather than a wrong one, so point `priceSelector` at the price itself. When both `.` and `,` appear, the last is the decimal mark. A single separator followed by exactly 3 digits is a decimal mark when the part before it is 0 (`0,999`) or the currency has 3 decimals (KWD, BHD, OMR, JOD, TND, IQD, LYD); otherwise `,` means thousands (`1,500` = 1500), and `.` means thousands only when the page names another currency (`1.299 €` = 1299, but `$1.299` = 1.299).
- **State.** One saved copy per URL + selector + price selector, inside the monitor name. The same URL listed twice with the same selectors is checked once. Two runs at the same time on the same monitor name overwrite each other's saved copies; give parallel schedules different names. Ignore patterns are not part of the saved copy's key: changing them makes every page show as changed once (and that check is charged).

# Actor input Schema

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

Public page URLs, up to 500 per run. Through the API you can also send objects: {"url": "...", "label": "...", "selector": "#pricing", "priceSelector": ".price"}. Pages that need a login or JavaScript to show their content are not supported.

## `monitorName` (type: `string`):

Name of the saved state. Runs with the same name compare against each other, so keep it the same on a schedule. 1-40 lowercase letters, digits or hyphens.

## `selector` (type: `string`):

Optional. Only text inside this selector is compared, for example #pricing or main. If it matches nothing, the page is reported as an error and not charged.

## `priceSelector` (type: `string`):

Optional. Element holding the price, for example .price_color. Without it the price is read from schema.org product data or price meta tags when the page has them.

## `reportOn` (type: `string`):

any = every text or price change. price = only price changes (text-only changes are saved but not listed).

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

When on, unchanged pages are not added to the results. New pages (first check) and errors are always listed. If nothing is listed, one free summary row says how many pages were checked.

## `ignorePatterns` (type: `array`):

Text matching these patterns is removed before comparing, for example dates or view counters: \["Updated \d{2}:\d{2}"]. Up to 20. RE2 syntax: backreferences and lookarounds are not supported.

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

1 to 10 (whole number). At most about 2 MB of HTML is parsed at the same time whatever this is set to.

## `timeoutSecs` (type: `integer`):

5 to 15. A page that has not finished downloading by then is reported as an error and not charged.

## `maxDiffLines` (type: `integer`):

Upper limit on how many lines are listed in the added list and, separately, in the removed list for one page. The full counts (addedCount, removedCount) are always reported. Between 1 and 500.

## `respectRobots` (type: `boolean`):

Read each site's robots.txt first and skip pages it disallows (skipped pages are not charged). Turn off only if you have permission to fetch these pages.

## Actor input object example

```json
{
  "urls": [
    "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html",
    "https://example.com/"
  ],
  "monitorName": "default",
  "priceSelector": ".price_color",
  "reportOn": "any",
  "onlyChanges": true,
  "maxConcurrency": 5,
  "timeoutSecs": 15,
  "maxDiffLines": 50,
  "respectRobots": true
}
```

# Actor output Schema

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

New baselines, changes and errors.

## `summary` (type: `string`):

Counts of checked, changed, unchanged, failed and charged pages.

# 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 = {
    "urls": [
        "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html",
        "https://example.com/"
    ],
    "priceSelector": ".price_color"
};

// Run the Actor and wait for it to finish
const run = await client.actor("leadharbor/page-change-price-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 = {
    "urls": [
        "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html",
        "https://example.com/",
    ],
    "priceSelector": ".price_color",
}

# Run the Actor and wait for it to finish
run = client.actor("leadharbor/page-change-price-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 '{
  "urls": [
    "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html",
    "https://example.com/"
  ],
  "priceSelector": ".price_color"
}' |
apify call leadharbor/page-change-price-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,leadharbor/page-change-price-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/od5oLewSsrMmj3Y6v/builds/V8B0AB1PBMOVA132N/openapi.json
