# AI Web Page Extractor: Structured Data from Any URL (`docfoundry/ai-page-extractor`) Actor

Describe what you want in plain English and get it back as JSON from any list of web pages: products, prices, contacts, listings, events. No selectors, no code. Pay per page.

- **URL**: https://apify.com/docfoundry/ai-page-extractor.md
- **Developed by:** [Nick Nguyen](https://apify.com/docfoundry) (community)
- **Categories:** AI, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 page extracteds

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

## AI Web Page Extractor: Structured Data from Any URL

Describe what you want in plain English, give it a list of web pages, and get the matching items back as
clean JSON or CSV: products and prices, quotes, job posts, events, contacts, table rows. No CSS selectors,
no code, nothing to fix when a site changes its layout.

- **Plain-English prompts.** "every book: title, price, star rating and the link to its page".
- **One record per page, items nested**, plus a CSV link with one row per item.
- **Reads what the page shows**, including links, image alt text, and ratings shown only as icons or
  classes (e.g. `star-rating Three`).
- **Pay per page, 3x below the usual price.** Pages that fail or where nothing matched are never charged.
- **Text-only mode**: leave the prompt empty to get each page's clean text (cheaper, no AI).

### Input

| Field | Type | Description |
|---|---|---|
| `urls` | array | Pages to read, one per line. Empty = a free format example. |
| `prompt` | string | What to extract, in plain English. Empty = clean page text instead. |
| `maxItemsPerPage` | integer | Upper limit on items per page (default 100, max 500). |

```json
{
    "urls": ["https://books.toscrape.com/", "https://books.toscrape.com/catalogue/page-2.html"],
    "prompt": "every book: title, price, star rating (1-5) and the link to its page",
    "maxItemsPerPage": 100
}
```

### Output (one record per page)

```json
{
    "url": "https://books.toscrape.com/",
    "status": "ok",
    "title": "All products | Books to Scrape - Sandbox",
    "itemCount": 20,
    "items": [
        {"title": "A Light in the Attic", "price": "£51.77", "starRating": 3,
         "url": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html"},
        {"title": "Tipping the Velvet", "price": "£53.74", "starRating": 1,
         "url": "https://books.toscrape.com/catalogue/tipping-the-velvet_999/index.html"}
    ],
    "truncated": false,
    "fetchedAt": "2026-10-20T15:20:11+00:00"
}
```

`status` is `ok`, `no-items` (the page loaded but nothing matched: not charged) or `failed` (with an
`error`: not charged). Use the **Items (CSV)** output link for one row per item.

Tested on 2026-10-20 on five public pages (book catalog, quotes, Hacker News front page, Python events,
a Wikipedia table): every page extracted, 6 to 30 items each.

### Pricing

Pay per event, no subscription.

| Event | Price | When it is charged |
|---|---|---|
| Page extracted | **$0.01** | Once per page, when at least one item came back. 1,000 pages = $10. |
| Page text | **$0.002** | Once per page in text-only mode (no prompt). |

Failed pages and pages with no matching items are never charged. Set a maximum charge in the run options and
the actor stops before it would go over. Apify's standard run-start event adds $0.00005 per run.

### Limits, stated plainly

- **Pages are fetched, not rendered.** The actor reads the HTML a browser receives, with a real-browser TLS
  fingerprint. Sites that build their content with JavaScript after loading, or that sit behind a login or a
  bot wall, may return little or nothing; those pages show up as `no-items` or `failed` and are not charged.
- **One page at a time, no crawling.** List every page you want (for example `?page=1` ... `?page=10`).
- **AI extraction can make mistakes.** The model is told to copy values exactly and to leave missing values as
  `null`, but spot-check important data.
- Very long pages are cut at about 200,000 characters; the record then has `truncated: true`.
- Apify free plan: up to 5 pages per run (each page costs us an AI call). Paid plans have no cap.
- You are responsible for having the right to extract data from the pages you list.

### Privacy

Pages you list are fetched and their text is sent to Anthropic's API (Claude) for extraction only. Nothing is
kept after the run except the results in your own dataset. The actor runs with limited permissions and reads
nothing else in your account.

# Actor input Schema

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

The pages to read, one per line. Each page is fetched once. Leave empty for a free format example.

## `prompt` (type: `string`):

Plain English, for example: "every book: title, price, star rating and the link to its page". Leave empty to get each page's clean text instead (cheaper, no AI).

## `maxItemsPerPage` (type: `integer`):

Stops very long lists from running past the AI's output limit.

## Actor input object example

```json
{
  "urls": [
    "https://books.toscrape.com/"
  ],
  "prompt": "every book: title, price, star rating and the link to its page",
  "maxItemsPerPage": 100
}
```

# Actor output Schema

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

Every page record with its extracted items.

## `itemsCsv` (type: `string`):

Extracted items unwound into one row each, with the page URL.

# 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/"
    ],
    "prompt": "every book: title, price, star rating and the link to its page"
};

// Run the Actor and wait for it to finish
const run = await client.actor("docfoundry/ai-page-extractor").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/"],
    "prompt": "every book: title, price, star rating and the link to its page",
}

# Run the Actor and wait for it to finish
run = client.actor("docfoundry/ai-page-extractor").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/"
  ],
  "prompt": "every book: title, price, star rating and the link to its page"
}' |
apify call docfoundry/ai-page-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,docfoundry/ai-page-extractor"
        }
    }
}
```

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/cJ3VLnNQQhxR1Eu1t/builds/Yj65B5LpVTn8gojPX/openapi.json
