# Website Screenshot, PDF, and Visual Change Monitor (`nichedata-lab/screenshot`) Actor

- **URL**: https://apify.com/nichedata-lab/screenshot.md
- **Developed by:** [nichedata-lab](https://apify.com/nichedata-lab) (community)
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.50 / 1,000 screenshot outputs

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## Website Screenshot, PDF, and Visual Change Monitor

Capture a public page as PNG, JPEG, WebP, or PDF. One run can use mobile, tablet, desktop, and custom viewports, hide cookie and chat chrome, and save only the element a CSS selector matches. Monitor mode compares the new shot with the previous PNG in a named key-value store and saves a row when the pixel change is above your threshold.

The same Actor is an MCP server in Standby mode. `take_screenshot`, `compare_pages`, and `capture_element` return a PNG image block and Markdown text.

The store handle for this Actor is `nichedata-lab/screenshot`. This repository does not publish it.

The Actor opens public http and https pages only. It does not log in, solve CAPTCHAs, or bypass bot checks. It reads robots.txt for each origin and skips a page the file disallows. A robots.txt redirect to another scheme, host, or port is not followed and is not treated as that origin's policy.

### How to run it

The prefilled input captures `https://example.com` as a desktop PNG.

| Input | What it does |
| --- | --- |
| Page URLs | Public http or https URLs. One capture per URL and device. |
| Mode | `capture`, `compare`, or `monitor`. |
| URL to compare against | Second page when mode is `compare`. |
| Devices | `mobile` (390x844), `tablet` (820x1180), `desktop` (1440x900), or `custom`. |
| Output formats | One or more of `png`, `jpeg`, `webp`, and `pdf`. |
| Full page | The scrolled page, or the viewport only. |
| CSS selector | The first visible match, instead of the page. |
| Wait until | `load`, `domcontentloaded`, or `networkidle`. |
| Delay after load | Milliseconds after the wait, up to 10000. |
| Scroll to the bottom | Loads lazy content, then returns to the top. |
| Hide banners | Built-in cookie, ad, and chat rules, plus your selectors. |
| Include page text as Markdown | Title and visible text on the dataset row. |
| Accept-Language, locale, timezone | `acceptLanguage` is sent on every request. Locale sets the browser locale and does not replace that header. Timezone is an IANA name. |
| Change threshold | Monitor saves a row only when the change is above this percent. |
| Baseline store and key | Named store that keeps the previous PNG across runs. |
| Maximum captures | Default 25. Hard cap 100. |

Example: desktop and mobile PNG of one page.

```json
{
  "urls": ["https://example.com"],
  "mode": "capture",
  "devices": ["desktop", "mobile"],
  "formats": ["png"],
  "fullPage": true,
  "cleanPage": true
}
```

Example: weekly check that saves a row only when the page moved more than 5 percent.

```json
{
  "urls": ["https://example.com/pricing"],
  "mode": "monitor",
  "devices": ["desktop"],
  "formats": ["png"],
  "changeThresholdPercent": 5,
  "baselineStore": "screenshot-baselines",
  "baselineKey": "pricing"
}
```

A monitor row includes `summary`, which is a single sentence a webhook can forward. The first run stores a baseline and saves that row. Later runs that stay at or under the threshold update the baseline and do not save a dataset row.

Compare mode always saves one row. `changed` is true when the pixel change is above the threshold. The percent counts every pixel. The diff PNG shows the top 4000 pixels.

### What a row contains

`url` and `finalUrl` keep the scheme, host, port, and path. Usernames, passwords, query strings, and fragments are removed before anything is stored. `files` lists each saved object with its key, byte size, and key-value URL. `diffFile` is set when a diff image was saved. `timingsMs` reports robots, navigation, capture, and total. Failed rows keep `url`, `status`, and `error`.

### Safety

Every request is checked again after DNS and after each redirect. A private, loopback, link-local, multicast, or other non-public address is refused, including the metadata address `169.254.169.254` and a decimal form such as `2130706433`. A private IP literal in `urls` is saved as a failed row and the run continues with the other URLs. The connection uses the address that passed that check. The browser does not open its own socket to the site. The Actor fetches the response and hands the bytes to Chromium. Chromium is launched with `--proxy-server=http://127.0.0.1:9`, and each browser context sets `service_workers` to `block`. A request that is not fulfilled by that fetch cannot leave the browser.

robots.txt is fetched per origin. The origin is the scheme, host, and port. `User-agent: *` applies to this Actor when no longer token matches `ScreenshotActor`. Paths are decoded, and `.` and `..` segments are resolved, before the rule is applied. A status from 400 to 499, including 403 and 429, means the file is unavailable under RFC 9309. Every path is allowed. A status from 500 to 599, or a fetch that fails, means the file is unreachable. Every path is blocked. A blocked row's `error` includes the fetch status and the matched rule.

### MCP

Standby serves the tools at `/mcp`.

| Tool | What it returns |
| --- | --- |
| `take_screenshot` | PNG image block and Markdown for one public URL. |
| `capture_element` | PNG of the element `selector` matches. |
| `compare_pages` | PNG of the diff, or of the current page when the change is at or under the threshold. Pass `compare_url`, or omit it to use this user's baseline. |

Apify does not pass `Authorization` into the container. The server reads `X-Apify-User-ID`, which the platform sets after it checks the caller. The baseline record name is a hash of that id and the state key. A request that sends only `Authorization` is not a caller, and a baseline tool refuses it. Dataset runs have no HTTP user id and use the baseline key from the input.

Standby output files and Standby baselines are deleted the next time Standby handles a request after they are 7 days old. Records written by a dataset run are not deleted on that schedule.

### Pricing

Proposed prices are in [PRICING.md](PRICING.md). They are not stored in `actor.json` and they are not approved Store prices. A failed capture is not charged. In a dataset run, a screenshot event is charged only after that row is pushed. The run stops when the next charge does not fit in the budget.

### Local checks

From `actors/screenshot`:

```bash
python -m pytest
PYTHONPATH=. python scripts/live_sample.py
```

The live script writes PNG, JPEG, WebP, and PDF files for public pages. It needs Chrome or the Playwright Chromium build.

# Actor input Schema

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

Public http or https pages. Usernames, passwords, and query tokens are removed from saved URLs.

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

capture saves images. compare diffs urls against compareUrl. monitor diffs each page against the previous capture in the baseline store and saves a row only when the change is above the threshold.

## `compareUrl` (type: `string`):

Required when mode is compare. The same devices and selector are used for both pages.

## `devices` (type: `array`):

One capture per device. mobile is 390x844, tablet is 820x1180, desktop is 1440x900. custom uses the width and height fields.

## `customWidth` (type: `integer`):

Width in pixels when a device is custom.

## `customHeight` (type: `integer`):

Height in pixels when a device is custom.

## `formats` (type: `array`):

Save one or more of png, jpeg, webp, and pdf.

## `fullPage` (type: `boolean`):

Capture the full scrolled page. Turn this off for the viewport only. Element captures ignore this.

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

Capture only the first visible element that matches. Leave empty for the page.

## `waitUntil` (type: `string`):

When to take the shot. load waits for the load event, domcontentloaded waits for HTML, and networkidle waits until the network is quiet.

## `delayMs` (type: `integer`):

Milliseconds to wait after waitUntil and before the shot.

## `scrollToBottom` (type: `boolean`):

Scroll the page so lazy content can load, then return to the top before the shot.

## `cleanPage` (type: `boolean`):

Hide common cookie banners, ads, and chat widgets before the shot.

## `hideSelectors` (type: `array`):

CSS selectors hidden in addition to the built-in banner rules. Braces are not allowed.

## `includeMarkdown` (type: `boolean`):

Save the page title and visible text as Markdown on the dataset row.

## `acceptLanguage` (type: `string`):

Accept-Language header sent on every request. Locale does not replace this value.

## `locale` (type: `string`):

Browser locale, such as en-US. This sets navigator.language and does not change Accept-Language.

## `timezone` (type: `string`):

IANA name, such as UTC or America/New_York.

## `changeThresholdPercent` (type: `number`):

Monitor mode saves a row only when the pixel change is above this number. Compare mode always saves a row and sets changed from the same rule.

## `baselineStore` (type: `string`):

Named key-value store that keeps the previous PNG. It persists across scheduled runs.

## `baselineKey` (type: `string`):

Name mixed into the stored record. Standby calls also mix in the platform user id, so two accounts do not share a baseline.

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

Cap on URL and device pairs in this run.

## `requestTimeoutSecs` (type: `integer`):

Seconds allowed for navigation and for an element shot.

## Actor input object example

```json
{
  "urls": [
    "https://example.com"
  ],
  "mode": "capture",
  "compareUrl": "",
  "devices": [
    "desktop"
  ],
  "customWidth": 1280,
  "customHeight": 800,
  "formats": [
    "png"
  ],
  "fullPage": true,
  "selector": "",
  "waitUntil": "load",
  "delayMs": 0,
  "scrollToBottom": false,
  "cleanPage": true,
  "includeMarkdown": false,
  "acceptLanguage": "en-US,en;q=0.9",
  "locale": "en-US",
  "timezone": "UTC",
  "changeThresholdPercent": 5,
  "baselineStore": "screenshot-baselines",
  "baselineKey": "default",
  "maxItems": 25,
  "requestTimeoutSecs": 30
}
```

# Actor output Schema

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

One row per saved capture. A monitor run omits pages under the change threshold.

# 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"
    ],
    "mode": "capture",
    "compareUrl": "",
    "devices": [
        "desktop"
    ],
    "formats": [
        "png"
    ],
    "selector": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("nichedata-lab/screenshot").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"],
    "mode": "capture",
    "compareUrl": "",
    "devices": ["desktop"],
    "formats": ["png"],
    "selector": "",
}

# Run the Actor and wait for it to finish
run = client.actor("nichedata-lab/screenshot").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://example.com"
  ],
  "mode": "capture",
  "compareUrl": "",
  "devices": [
    "desktop"
  ],
  "formats": [
    "png"
  ],
  "selector": ""
}' |
apify call nichedata-lab/screenshot --silent --output-dataset

```

## MCP server setup

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

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/fwvVSIdN75IZDSFc7/builds/yLToffu0AemgKQwT6/openapi.json
