# Website Scraper — Web Page HTML, Text & Screenshot API (`agentxpro/web-page-scraper`) Actor

Website scraper that renders pages in a real browser engine: get the rendered HTML, visible text, page title and a PNG screenshot for every URL — including JavaScript-heavy pages that plain fetchers miss. Pay per delivered page; failed pages are never charged.

- **URL**: https://apify.com/agentxpro/web-page-scraper.md
- **Developed by:** [Agent X](https://apify.com/agentxpro) (community)
- **Categories:** Developer tools, AI
- **Features:** Limited permissions
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 page results

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

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 Scraper — Web Page HTML, Text & Screenshot API

A website scraper for pages that need a real browser. Give it a list of
URLs: each page is opened in a browser engine, its JavaScript runs to
completion, and you get back what a visitor would actually see. Use it as
a web page scraper, a rendered-HTML fetcher, or a URL screenshot API:

- **Rendered HTML** — the DOM after JavaScript, not the raw source a
  plain fetcher returns
- **Visible text** — the readable text of the rendered page
- **Markdown** — the page content as clean Markdown, the format AI
  tools and RAG pipelines read best
- **Metadata** — description, canonical, Open Graph / Twitter tags,
  JSON-LD, word count
- **Links & images** — every link and image on the page, as lists
- **Page title**
- **Screenshots** — viewport or full-page, PNG / JPEG / WebP
- **PDF** — the page printed to PDF by the browser engine
- **Bounded crawling** — follow same-domain links to a set depth and
  page cap
- **Site map (URL discovery)** — Map mode lists the URLs of a whole
  site: give it the site, get back every URL found in its sitemaps
  and page links, one row per URL, for one flat page price per site

Built for pages that plain HTTP fetchers cannot read: JavaScript apps,
client-side rendered articles, dashboards and docs that arrive as an
empty shell without a browser.

### Input

| Field | Type | Default | Meaning |
|---|---|---|---|
| `urls` | list of URLs | — (required) | Pages to render (in Map mode: sites to map) |
| `mode` | string | scrape | `scrape` renders the URLs; `map` discovers the URLs of each site instead |
| `waitMs` | number | 2000 | Extra wait after load so late rendering finishes |
| `includeHtml` | boolean | true | Return rendered HTML |
| `includeText` | boolean | true | Return visible text |
| `includeScreenshot` | boolean | true | Return base64 PNG screenshot |
| `maxConcurrency` | number | 3 | Pages rendered in parallel (1–8) |
| `includeMarkdown` | boolean | false | Add a `markdown` field (content converted to Markdown) |
| `mainContent` | boolean | false | Extract the main content block (`contentHtml`); text and Markdown are built from it |
| `includeMetadata` | boolean | false | Add a `metadata` field (description, canonical, OG/Twitter tags, JSON-LD, word count, final URL) |
| `includeLinks` | boolean | false | Add a `links` field: every link as `{url, text}` |
| `includeImages` | boolean | false | Add an `images` field: every image as `{url, alt}` |
| `includePdf` | boolean | false | Add a `pdfBase64` field (page printed to PDF) |
| `screenshotFullPage` | boolean | false | Capture the full scrollable page height |
| `screenshotFormat` | string | png | `png`, `jpeg` or `webp` |
| `viewportWidth` / `viewportHeight` | number | — | Browser viewport size, e.g. 390×844 for a phone |
| `waitForSelector` | string | — | Wait until this CSS selector exists before extracting |
| `scrollToBottom` | boolean | false | Scroll to the bottom first (lazy-loaded content) |
| `removeSelectors` | list | — | CSS selectors of elements to delete before extraction |
| `dismissCookieBanners` | boolean | false | Remove common cookie-consent banners first |
| `headers` | object | — | Extra HTTP headers sent with every page load |
| `cookies` | list | — | Cookies to set before loading: `{name, value, domain?}` |
| `crawlDepth` | number | 0 | Follow links this many levels deep (max 5) |
| `maxPages` | number | 25 | Total page cap when crawling |
| `crawlSameDomainOnly` | boolean | true | Crawling: stay on the starting domain |
| `crawlIncludePatterns` / `crawlExcludePatterns` | list | — | Crawling: only follow / never follow URLs containing these fragments |
| `mapMaxUrls` | number | 1000 | Map mode: maximum discovered URLs returned per site (up to 5000) |
| `mapSearch` | string | — | Map mode: return only URLs containing this text (case-insensitive) |
| `includeSubdomains` | boolean | false | Map mode: also collect URLs on subdomains of the site |
| `agentContext` | boolean | false | Add an `agentContext` object to every delivered row (see *For AI agents* below). Never changes charges |

### Output

One dataset item per URL:

```json
{
  "url": "https://example.com/",
  "status": 200,
  "title": "Example Domain",
  "html": "<html>…rendered DOM…</html>",
  "text": "Example Domain This domain is for use in …",
  "screenshotBase64": "iVBORw0KGgo…",
  "fetchedAt": "unix:1763596800"
}
```

Optional fields appear only when switched on: `markdown`, `contentHtml`
(main-content mode), `metadata`, `links`, `images`, `pdfBase64`.

Pages that fail to load, return an HTTP error (4xx/5xx), or return no
readable content, come back as `{ "url": …, "status": …, "error": "…" }`
and are **never charged**.

In **Map mode** the output is one row per discovered URL instead:

```json
{
  "url": "https://example.com/about",
  "source": "sitemap",
  "site": "https://example.com",
  "lastmod": "2026-01-15"
}
```

`source` is `sitemap` for URLs declared in the site's sitemap files
(`lastmod` is included when the sitemap provides it) and `link` for
URLs found in the links of the site's pages. URLs are deduplicated
and stay on the site's own domain unless `includeSubdomains` is on.
A site that cannot be reached comes back as a single error row and
is **never charged**.

### For AI agents

Turn on `agentContext` and every delivered row also carries an
`agentContext` object, shaped the way AI-agent context APIs answer:
the content cleaned and ready to paste straight into an LLM prompt,
where it came from, and how big it is — no HTML scraping or token
counting left to the caller.

```json
{
  "agentContext": {
    "text": "# Example Domain\n\nThis domain is for use in documentation examples…",
    "source": { "type": "page", "url": "https://example.com/", "title": "Example Domain" },
    "citation": "\"Example Domain\" — https://example.com/",
    "tokens": 21,
    "retrievedAt": "2026-11-22T10:15:30Z"
  }
}
```

- `text` — the page content as clean Markdown (built from the main
  content when `mainContent` is on), with page machinery stripped.
  In Map mode it is the discovered URL itself.
- `source` — `{type, url, title}`: where this row came from.
- `citation` — a ready-to-paste citation line for the row.
- `tokens` — estimated token count of `text` (≈4 characters per
  token), so an agent can budget its context window.
- `retrievedAt` — ISO 8601 UTC time the row was retrieved.

`agentContext` is off by default, adds no rows, and never changes
charges — it rides on the rows you already pay for.

### Example input

```json
{
  "urls": ["https://example.com/", "https://news.ycombinator.com/"],
  "waitMs": 2000,
  "includeScreenshot": true
}
```

Markdown + metadata for an AI pipeline, cookie banner removed:

```json
{
  "urls": ["https://blog.example.com/post"],
  "includeMarkdown": true,
  "includeMetadata": true,
  "includeLinks": true,
  "dismissCookieBanners": true,
  "includeScreenshot": false
}
```

Mobile full-page screenshot:

```json
{
  "urls": ["https://example.com/"],
  "viewportWidth": 390,
  "viewportHeight": 844,
  "screenshotFullPage": true,
  "screenshotFormat": "jpeg"
}
```

A bounded same-domain crawl:

```json
{
  "urls": ["https://en.wikipedia.org/wiki/Kitesurfing"],
  "crawlDepth": 1,
  "maxPages": 25,
  "crawlSameDomainOnly": true
}
```

Discover every URL on a site (Map mode), keeping only the ones
about pricing:

```json
{
  "mode": "map",
  "urls": ["https://example.com"],
  "mapMaxUrls": 1000,
  "mapSearch": "pricing"
}
```

### Use it from code (API)

```bash
curl -X POST "https://api.apify.com/v2/acts/agentxpro~web-page-scraper/run-sync-get-dataset-items?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "urls": ["https://example.com/"], "includeMarkdown": true }'
```

```python
from apify_client import ApifyClient
client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("agentxpro/web-page-scraper").call(run_input={
    "urls": ["https://example.com/"], "includeMarkdown": True,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["title"], len(item.get("markdown", "")))
```

### Use with AI agents (MCP)

Connect your MCP client (Claude, ChatGPT, Cursor) to Apify's official
MCP server (https://mcp.apify.com) with your Apify token and add this
actor (`agentxpro/web-page-scraper`) to the tool list — the agent can
then render pages, read Markdown and take screenshots in plain
language. Pay-per-page pricing applies exactly as with API runs.

### Use cases

- **Scrape JavaScript websites** — React, Vue and other single-page apps that return an empty shell to plain fetchers.
- **Screenshot any URL** — visual checks, page-change monitoring, evidence captures, thumbnails for reports.
- **Feed RAG and AI agents** — clean visible text or Markdown from pages that need rendering first, ready for indexing; metadata and link lists included when you want them.
- **Rendered HTML for debugging** — see the exact DOM your visitors (and search engines) get after scripts run.

### Pricing

Pay per event, no subscription:

- **$0.0015 per delivered page** ($1.50 per 1,000 pages)
- **Map mode: $0.0015 per site mapped** — one flat page price per
  site, however many URLs it returns (up to your `mapMaxUrls` cap)
- $0.0001 actor start per run
- Failed pages are free — you only pay for pages you actually receive.
  Unreachable sites in Map mode are free too.

### FAQ

**How is this different from a regular website scraper?**
Regular scrapers fetch raw HTML — on JavaScript-heavy sites that's an empty shell. This actor renders the page in a browser engine first, so you get the content a visitor actually sees.

**Can it scrape React / single-page app websites?**
Yes — that is exactly what it is built for. If a page needs JavaScript to show its content, this is the tool; if a page is plain HTML, a cheaper fetcher will do.

**How do I take a screenshot of a URL?**
Leave `includeScreenshot` on (the default). Every delivered page includes a base64-encoded PNG of the rendered viewport in `screenshotBase64`.

**Does it bypass CAPTCHAs, logins or paywalls?**
No. Pages behind bot checks, login walls or paywalls come back as errors or empty — and failed pages are never charged.

**What does one page cost?**
$0.0015 per delivered page ($1.50 per 1,000 pages), plus a $0.0001 run start. Failed pages are free.

**Can I get Markdown instead of HTML?**
Yes — `includeMarkdown` adds a clean Markdown version of the content (code and style sections stripped). Pair it with `mainContent` to get Markdown of just the article body.

**Can it crawl a site?**
Yes, in a bounded way: `crawlDepth` follows links from your starting pages (same domain by default), capped by `maxPages`, with include/exclude URL patterns to steer it. Every delivered page is billed at the normal per-page price.

**Can it take full-page or mobile screenshots?**
Yes — `screenshotFullPage` captures the whole scrollable height, `viewportWidth`/`viewportHeight` set the window size (e.g. 390×844 for a phone), and `screenshotFormat` picks PNG, JPEG or WebP.

**Can it save a page as PDF?**
Yes — `includePdf` adds the browser-printed PDF, base64-encoded, as `pdfBase64`.

**Can it list all the URLs on a website?**
Yes — Map mode. Set `mode` to `map` and give it the site: you get back every URL found in the site's sitemaps and the links on its pages (deduplicated, same-domain unless you allow subdomains), one row per URL, for one flat page price per site. Use `mapSearch` to keep only URLs containing a word.

### Honest limits

- This is a **lightweight, experimental browser engine**, not a full
  desktop browser. Most pages render well; some very heavy or unusual
  pages may render imperfectly.
- **No CAPTCHA or bot-wall bypass.** Pages protected by bot checks,
  login walls or paywalls will come back as errors or empty — this
  tool does not try to defeat them.
- Screenshots are the visible viewport by default; full-page capture is
  available with `screenshotFullPage`.
- Map mode reads sitemaps and follows on-site links without rendering
  pages, so URLs that only appear after JavaScript runs may be
  missed. If you need those, scrape the site with crawl depth instead.

### Support

Questions and bug reports: use the Issues tab on this Actor's page.

# Actor input Schema

## `cookies` (type: `array`):

Cookies to set before loading each page: an array of objects like {"name": "session", "value": "abc", "domain": ".example.com"}. The domain is optional — without it the cookie is set for the page URL being loaded.

## `crawlDepth` (type: `integer`):

Follow links found on rendered pages and scrape those pages too, up to this many levels deep (0 = only the URLs you give, 1 = also every linked page, and so on; maximum 5). Discovered pages are charged the same per-page price. Combine with Max crawl pages and the same-domain switch to keep crawls bounded.

## `crawlExcludePatterns` (type: `array`):

Crawling: skip discovered URLs containing any of these text fragments (for example /login or .pdf).

## `crawlIncludePatterns` (type: `array`):

Crawling: only follow discovered URLs containing at least one of these text fragments (for example /products/). Leave empty to follow all links that pass the other crawl filters.

## `crawlSameDomainOnly` (type: `boolean`):

Crawling: only follow links on the same domain as the starting URL they were found from.

## `dismissCookieBanners` (type: `boolean`):

Remove common cookie-consent banners and overlays (OneTrust, Cookiebot, Didomi and similar) before extracting content and screenshots.

## `headers` (type: `object`):

Extra HTTP headers sent with every page load, as a JSON object of header names to values, for example {"Accept-Language": "en-US", "X-Custom": "1"}.

## `includeHtml` (type: `boolean`):

Return the full rendered HTML (after JavaScript) as the html field.

## `includeImages` (type: `boolean`):

Add an images field: every image on the page as {url, alt}.

## `includeLinks` (type: `boolean`):

Add a links field: every link on the page as {url, text} (absolute URLs, duplicates removed).

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

Add a markdown field: the page content converted to Markdown — the format AI tools and RAG pipelines read best. With Main content only on, the Markdown is built from the extracted main content.

## `includeMetadata` (type: `boolean`):

Add a metadata field: page title, description, keywords, author, canonical URL, language, final URL after redirects, Open Graph and Twitter card tags, JSON-LD blocks, and a word count of the visible text.

## `includePdf` (type: `boolean`):

Add a pdfBase64 field: the page printed to PDF by the browser engine, base64-encoded.

## `includeScreenshot` (type: `boolean`):

Capture a PNG screenshot of the rendered page (returned base64-encoded as screenshotBase64).

## `includeSubdomains` (type: `boolean`):

Map mode only: also collect URLs on subdomains of the site (for example docs.example.com when mapping example.com). Off keeps results on the site's own host.

## `includeText` (type: `boolean`):

Return the visible page text as the text field.

## `mainContent` (type: `boolean`):

Extract the main content block of the page (the <main> or <article> element, or the largest text block): it is returned as contentHtml, and the text and Markdown fields are built from it instead of the whole page — navigation, sidebars and footers drop out.

## `mapMaxUrls` (type: `integer`):

Map mode only: the maximum number of discovered URLs returned per site. The price is the same however many URLs come back — one flat page price per site.

## `mapSearch` (type: `string`):

Map mode only: return only discovered URLs that contain this text (case-insensitive) — for example pricing, /docs/ or .pdf. Leave empty to return everything found.

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

How many pages to render in parallel. Default 3.

## `maxPages` (type: `integer`):

Crawling: the maximum total number of pages to process in one run, including the starting URLs. Only applies when Crawl depth is above 0.

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

Scrape renders every URL in the list and returns its content. Map treats every URL as a site and discovers its URLs instead — from the site's sitemaps and the links on its pages — returning one row per discovered URL for one flat page price per site.

## `removeSelectors` (type: `array`):

CSS selectors for elements to delete from the page before extracting content and screenshots — for example .popup, #paywall, div.ad-slot.

## `screenshotFormat` (type: `string`):

Screenshot image format.

## `screenshotFullPage` (type: `boolean`):

Capture the full scrollable page height in the screenshot instead of just the visible viewport.

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

Scroll to the bottom of the page before extracting content, so lazy-loaded images and text load first.

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

List of page URLs to render. Each URL is opened in a real browser engine, its JavaScript runs, and the rendered result is returned. Works on JavaScript-heavy pages that regular website scrapers return empty. In Map mode, each URL is treated as a site whose URLs you want discovered.

## `viewportHeight` (type: `integer`):

Browser viewport height in pixels (set together with Viewport width), for example 1080 for desktop or 844 for a phone.

## `viewportWidth` (type: `integer`):

Browser viewport width in pixels (set together with Viewport height), for example 1920 for desktop or 390 for a phone.

## `waitForSelector` (type: `string`):

Wait until this CSS selector exists on the page before extracting content (up to ~15 seconds), for example .product-list or #results. Extraction continues either way after the timeout.

## `waitMs` (type: `integer`):

How long to wait after the page load event before extracting content, so late JavaScript rendering can finish. Default 2000.

## `agentContext` (type: `boolean`):

Add an agentContext object to every delivered row: the page content as clean Markdown text ready to paste into an LLM prompt, a source block (type, URL, title), a ready-to-paste citation, an estimated token count and the retrieval time. Modelled on the response style AI-agent APIs use. Off by default; never changes charges.

## Actor input object example

```json
{
  "crawlDepth": 0,
  "crawlSameDomainOnly": true,
  "dismissCookieBanners": false,
  "includeHtml": true,
  "includeImages": false,
  "includeLinks": false,
  "includeMarkdown": false,
  "includeMetadata": false,
  "includePdf": false,
  "includeScreenshot": true,
  "includeSubdomains": false,
  "includeText": true,
  "mainContent": false,
  "mapMaxUrls": 1000,
  "maxConcurrency": 3,
  "maxPages": 25,
  "mode": "scrape",
  "screenshotFullPage": false,
  "scrollToBottom": false,
  "urls": [
    "https://example.com/"
  ],
  "waitMs": 2000,
  "agentContext": false
}
```

# Actor output Schema

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

One item per requested URL: url, HTTP status, page title, rendered HTML, visible text and a base64 PNG screenshot. Failed pages appear as error items and are never charged. In Map mode, one item per discovered URL: url, source (sitemap or link), site, and lastmod when the sitemap provides it.

# 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("agentxpro/web-page-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 = { "urls": ["https://example.com/"] }

# Run the Actor and wait for it to finish
run = client.actor("agentxpro/web-page-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 '{
  "urls": [
    "https://example.com/"
  ]
}' |
apify call agentxpro/web-page-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,agentxpro/web-page-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/yG3lhpmRySqRuhche/builds/rEx1WIMiFTILDj0Rh/openapi.json
