# Semantic Change Detector (`andok/semantic-change-detector`) Actor

Monitor web pages for meaningful content changes, ignoring noisy timestamps and counters. Optional webhook alerts on change. $0.005/URL + $0.02 start.

- **URL**: https://apify.com/andok/semantic-change-detector.md
- **Developed by:** [Andok](https://apify.com/andok) (community)
- **Categories:** Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 url 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/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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use 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

## Semantic Change Detector

Monitor any set of web pages for **meaningful** content changes — not just noisy re-renders. This Actor extracts readable text (optionally scoped to a CSS selector), strips heuristic "noise" like timestamps, relative dates, clock times, and engagement counters, and compares the result against the last stored snapshot. When a page changes, it reports a human-readable summary, a diff excerpt, and can fire a webhook.

### Features

- **Two sensitivity modes** — `meaningful` (ignores timestamps/counters) or `any` (raw text diff)
- **CSS selector scoping** — check only the part of the page you care about (e.g. a pricing table or article body)
- **Persistent snapshots** — stores the last-seen state per URL in a named key-value store (`semantic-change-snapshots`), so subsequent runs detect real drift over time
- **Diff excerpts** — see exactly which lines were added/removed on change
- **Webhook alerts** — optional fire-and-forget JSON POST when a change is detected
- **Resilient per-URL errors** — a failed fetch on one URL never stops the batch

### Input

| Field | Type | Required | Default | Description |
|-------|------|-----------|---------|-------------|
| `urls` | `array` | Yes | — | Web pages to check |
| `selector` | `string` | No | — | CSS selector to scope extraction (defaults to `<body>`) |
| `sensitivity` | `"any"` \| `"meaningful"` | No | `"meaningful"` | Change detection strictness |
| `webhookUrl` | `string` | No | — | URL to POST a JSON payload to when a change is detected |

#### Input Example

```json
{
  "urls": ["https://example.com/pricing"],
  "selector": ".pricing-table",
  "sensitivity": "meaningful",
  "webhookUrl": "https://your-app.com/webhooks/change-alert"
}
````

### Output

```json
{
  "url": "https://example.com/pricing",
  "changed": true,
  "change_summary": "Content changed: 2 line(s) added, 1 line(s) removed.",
  "diff_excerpt": "- Starter plan: $9/mo\n+ Starter plan: $12/mo\n+ New Enterprise tier available",
  "checked_at": "2026-07-23T16:00:00.000Z"
}
```

| Field | Description |
|-------|-------------|
| `url` | The input URL, as provided |
| `changed` | `true` if the content differs from the last stored snapshot |
| `change_summary` | Human-readable summary of the change (or lack thereof) |
| `diff_excerpt` | Up to 8 removed + 8 added lines (`-`/`+` prefixed), truncated to ~2000 characters. `null` if unchanged |
| `checked_at` | ISO timestamp of this check |
| `error` | Present only if the fetch/extraction failed for this URL |

On the **first** check for a URL there is no baseline yet, so `changed` is `false` and the snapshot is simply stored for future comparisons.

### How "meaningful" filtering works

Before hashing/diffing, each extracted line has the following heuristics applied to strip volatile noise:

- ISO 8601 timestamps, numeric dates, month-name dates
- Clock times (`10:30`, `10:30:00 AM`)
- Relative timestamps (`5 minutes ago`, `yesterday`, `just now`)
- Engagement counters (`1,234 views`, `12 comments`, `3.4k likes`)

These are regex-based heuristics, not a guarantee: some volatile content may occasionally slip through, and rarely meaningful text containing dates/numbers may be stripped along with them. Use `sensitivity: "any"` if you want a literal raw-text diff instead.

### Pricing

| Event | Cost |
|-------|------|
| Actor start | $0.02 |
| URL Checked | $0.005 |

**Typical run cost:** 100 URLs ≈ `$0.02 + 100 × $0.005 = $0.52`.

### Limitations

- **Static HTML only** — this Actor fetches raw HTML via `fetch` + Cheerio; it does **not** execute JavaScript. Pages that render their content client-side (SPAs) may show no extractable text. Use a URL that serves server-rendered HTML, or point at an API/RSS endpoint instead.
- Snapshots are capped at 4,000 lines per URL to keep key-value store items small; extremely long pages may be truncated.
- Webhook delivery is fire-and-forget with a 10s timeout and no retries — failures are logged but never fail the run.
- The named key-value store (`semantic-change-snapshots`) persists across runs of the same Actor on the same account, so re-running with the same URLs will correctly detect drift since the last run.

### Use Cases

- Track competitor pricing pages for changes
- Monitor legal/ToS pages for updates
- Watch documentation pages for silent edits
- Alert on job posting or status page changes

# Actor input Schema

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

List of web pages to check for content changes.

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

Optional CSS selector to scope extraction to a specific part of the page (e.g. "main", "#content", ".article-body"). If omitted, the full <body> text is used.

## `sensitivity` (type: `string`):

"meaningful" strips common timestamps, relative dates, clock times, and engagement counters (views/likes/comments) before comparing, to avoid false positives from auto-updating widgets. "any" compares the raw extracted text verbatim.

## `webhookUrl` (type: `string`):

Optional URL to receive a fire-and-forget JSON POST notification whenever a change is detected on any of the input URLs.

## Actor input object example

```json
{
  "urls": [
    "https://example.com"
  ],
  "sensitivity": "meaningful"
}
```

# Actor output Schema

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

No description

## `resultsCsv` (type: `string`):

No description

## `run` (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 = {
    "urls": [
        "https://example.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("andok/semantic-change-detector").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://example.com"] }

# Run the Actor and wait for it to finish
run = client.actor("andok/semantic-change-detector").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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://example.com"
  ]
}' |
apify call andok/semantic-change-detector --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=andok/semantic-change-detector",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Semantic Change Detector",
        "description": "Monitor web pages for meaningful content changes, ignoring noisy timestamps and counters. Optional webhook alerts on change. $0.005/URL + $0.02 start.",
        "version": "1.0",
        "x-build-id": "iQTndseV9LC9JPwlC"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/andok~semantic-change-detector/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-andok-semantic-change-detector",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/andok~semantic-change-detector/runs": {
            "post": {
                "operationId": "runs-sync-andok-semantic-change-detector",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/andok~semantic-change-detector/run-sync": {
            "post": {
                "operationId": "run-sync-andok-semantic-change-detector",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "urls"
                ],
                "properties": {
                    "urls": {
                        "title": "URLs",
                        "minItems": 1,
                        "type": "array",
                        "description": "List of web pages to check for content changes.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "selector": {
                        "title": "CSS Selector",
                        "type": "string",
                        "description": "Optional CSS selector to scope extraction to a specific part of the page (e.g. \"main\", \"#content\", \".article-body\"). If omitted, the full <body> text is used."
                    },
                    "sensitivity": {
                        "title": "Sensitivity",
                        "enum": [
                            "any",
                            "meaningful"
                        ],
                        "type": "string",
                        "description": "\"meaningful\" strips common timestamps, relative dates, clock times, and engagement counters (views/likes/comments) before comparing, to avoid false positives from auto-updating widgets. \"any\" compares the raw extracted text verbatim.",
                        "default": "meaningful"
                    },
                    "webhookUrl": {
                        "title": "Webhook URL",
                        "type": "string",
                        "description": "Optional URL to receive a fire-and-forget JSON POST notification whenever a change is detected on any of the input URLs."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
