# AI Scraper Builder Selextract: describe the data, get a scraper (`stefanie-rink/ai-scraper-builder`) Actor

Describe the data you want in plain English. The Actor builds a scraper, checks that it returns that data, and saves the rows to your dataset. Re-run saved scrapers by ID without building again.

- **URL**: https://apify.com/stefanie-rink/ai-scraper-builder.md
- **Developed by:** [Steafanie Braid](https://apify.com/stefanie-rink) (community)
- **Stats:** 2 total users, 1 monthly users, 66.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / scraper build

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 Scraper Builder Selextract: describe the data, get a scraper

Tell this Actor what data you want in plain English. It finds the right pages, writes a scraper for them,
checks that the scraper really returns that data, and saves the rows to your dataset.

No selectors, no code and no URL needed, though a URL helps. Build a scraper once, then re-run it for fresh
data without building again.

### Quick answers

**What does it cost?**
A new scraper costs $4.00, charged only if it passes the check. Every run costs $0.10, plus $0.003 per row.
So a new scraper with 100 rows costs $4.40, and each re-run with 100 rows costs $0.40.
[Full pricing](#pricing)

**What if the build fails?**
You pay nothing for the build, the run or results. Apify's small start fee may still apply.

**How long does a build take?**
Usually 5 to 10 minutes, at most 14. A re-run takes only as long as the scraper needs to collect the rows.

**Where do I find my scraper ID?**
When the run finishes, the scraper ID is in the message at the top of the run page and in the run's **Log**.
It is also in the run's **Output** tab, under **Scraper ID and re-run input**. You can also use the run's own
ID instead: any run that built or ran a scraper points to that scraper.

**How do I get fresh data later without paying for a new build?**
Run the Actor with this input:

```json
{ "scraperId": "<your scraper ID or run ID>", "mode": "rerun", "maxResults": 100 }
```

To collect new rows on a schedule, save this input as an Apify Task and schedule the Task.

**Can I change what my scraper looks for?**
Partly. Some scrapers take inputs, such as a search term or a category. After a build, the Log and the
Output tab list the inputs your scraper takes. Set them in **Scraper inputs** when you re-run it:

```json
{ "scraperId": "<your scraper ID>", "mode": "rerun", "scraperInput": { "query": "running shoes" } }
```

The website and the fields stay the same. For another website or other fields, build a new scraper. If you
give a prompt or URL together with a scraper ID, they are ignored.

**Will the Actor reuse my scraper if I enter the same prompt again?**
Yes, in Auto mode, if the prompt and URL are word for word the same as one of your earlier successful builds.
The status message and the Log tell you when this happens, and there is no build charge. Capital letters and
extra spaces don't matter; any other change means a new build. Only your own scrapers are reused.

**How do I rebuild a scraper, for example after the website changed?**
Run the Actor in Build mode with the same prompt and URL, or with the scraper ID. Under **How to build
again**, choose **Fresh build** to start from scratch, or **Repair** to fix your current scraper. The result
becomes a new version with the same scraper ID, so your Tasks keep working. A rebuild costs $4.00, like a
build, and only if the new version passes the check. If it doesn't, the current version stays and nothing is
charged.

**What happens when the website changes?**
The scraper keeps doing what it did when it was built. If the page changed, it may find no rows (you pay
$0.10 for the run, nothing for results), or the Actor tells you the scraper can't run anymore. Then rebuild
it, as described above. In Auto mode, if your scraper for the same request can't run anymore, the Actor
rebuilds it for you.

**What happens if I start the example as it is?**
The prefilled example request runs a ready-made example scraper, so you see results quickly, with no build
charge. You pay for the run and results. Change the prompt to build your own scraper.

**What can I do on the Apify Free plan?**
You can try a build. Each version of a scraper built on the Free plan runs twice: once right after its build,
and one re-run. So scheduled Tasks need a paid Apify plan. Free builds are limited too.
[More](#apify-free-plan)

**Can someone in another Apify account use my scraper ID?**
No. Scraper IDs and run IDs only work in the Apify account that built the scraper.

### What you can ask for

- "Top 30 stories on Hacker News with title, link, points and comment count"
- "All fiction books on books.toscrape.com with title, price, rating and stock status"
- "Upcoming tech conferences in Europe in 2027: name, city, dates and website"

The more specific you are about the fields you want, the closer the result matches what you need.

### How it works

1. **Build.** The Actor explores the website and writes a scraper for your request.
2. **Check.** The scraper runs on its own, and its rows are checked against your request. If they don't
   match, the build counts as failed and you pay nothing for it.
3. **Run.** The checked scraper runs and saves up to `maxResults` rows to your dataset. You get a scraper ID.
4. **Re-run.** Later runs use the scraper ID. They skip the build and the check and go straight to the run.
5. **Rebuild when needed.** A rebuild makes a new version of the same scraper. It goes through the same
   check, and the scraper ID stays the same.

### Pricing

You pay per event, through Apify:

| Event | When it is charged | Price |
| --- | --- | --- |
| Scraper build | Once per run, only when the new scraper or new version passes the check | $4.00 |
| Scraper run | Each time a scraper runs (after a build or on a re-run) | $0.10 |
| Result | Each row saved to your dataset | $0.003 |

Examples:

- A new scraper with 100 rows: $4.00 + $0.10 + $0.30 = **$4.40**.
- Re-running a saved scraper for 100 rows: $0.10 + $0.30 = **$0.40**.
- A re-run that finds no rows: **$0.10**.
- A build or rebuild that fails the check: **no build, run or result charge**. Apify's small start fee may
  still apply.

Set a maximum cost for your run in Apify. The Actor checks that the build, the run and at least some results fit
under it before it starts. If they don't, it stops right away with a message.

### Apify Free plan

On the Free plan you can try a build, then run the scraper you built. Each version of a scraper built on the
Free plan can run twice in total: the run right after its build and one re-run.

Free builds are limited: each free account gets a small number of builds per month, and there is a shared
daily limit for all free accounts. Rebuilds count as builds. When a limit is reached, the Actor stops before
doing any work and tells you when to try again.

### Input

| Field | What it does |
| --- | --- |
| `prompt` | The data you want, in plain English. Required unless you give a `scraperId`. |
| `url` | Optional. A page to start from. |
| `scraperId` | Optional. A scraper ID, or the run ID of a run that built or ran a scraper. Re-runs that scraper without building again. |
| `scraperInput` | Optional. Values for the scraper's own inputs, as JSON. Used when an existing scraper runs, not on a new build. |
| `mode` | See below. Default `auto`. |
| `rebuildMethod` | `fresh` (default) or `repair`. Used only when the Actor rebuilds a scraper you already have. |
| `maxResults` | The most rows to save. Default 100, maximum 1,000. |

Modes:

- **`auto`**: re-runs the scraper when you give a `scraperId`, or when your prompt and URL are word for word the
  same as one of your earlier successful builds. Otherwise it builds a new scraper.
- **`build`**: always builds. For a request you already have a scraper for, or with a `scraperId`, it builds a
  new version of that scraper.
- **`rerun`**: only re-runs the scraper in `scraperId` and never builds. Use it for scheduled Tasks.

### Output

- **Dataset:** one item per row, with the fields the scraper found.
- **`OUTPUT` record** (the run's **Output** tab, under **Scraper ID and re-run input**): the scraper ID and
  version, what the run did (built, rebuilt, reused or re-ran a scraper), the fields, the inputs the scraper
  takes and the values this run used, row counts, what was charged, and the exact input to re-run this
  scraper.

### Limits

- Sites that need a login are not supported.
- Some websites block automated access. If the Actor can't get the data, the build fails and you pay nothing
  for it.
- Leave the run timeout at the default (60 minutes) so there is time to wait, build and run.
- At most 1,000 rows per run.
- When many builds run at once, your request waits its turn. The status message shows your place in line.

### Your data

Your prompt and the extracted rows are processed on this Actor's servers to build and run your scraper.
Your saved scrapers and their runs are kept so you can re-run them, and no other user can see them. What we
learn about a public website's page structure (not your rows and not your prompt) may help build scrapers
for that website faster.

If a run fails, we receive an error report that includes the run's input, so we can fix the problem. Error reports never include your Apify token or the scraped data.

### Questions and problems

Open an issue on the Issues tab. Include the run ID and the scraper ID if you have one.

# Actor input Schema

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

Describe the data in plain English, including the fields you need. Example: "All fiction books on books.toscrape.com with title, price, rating and stock status". Required unless you give a scraper ID.

## `url` (type: `string`):

A page to start from. Leave empty to let the Actor find the right site.

## `scraperId` (type: `string`):

Re-run a scraper you built before, without building again. Enter its scraper ID, or the run ID of an earlier run of this Actor that built or ran it. You'll find the scraper ID in that run's status message, Log and Output tab.

## `scraperInput` (type: `object`):

Values for the scraper's own inputs, such as a search term, as JSON. Example: {"query": "running shoes"}. Used when an existing scraper runs (a re-run or a reused scraper), not on a new build. After a build, the Log and the Output tab list the inputs that scraper takes.

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

Auto reuses your scraper when you give a scraper ID or run ID, or repeat one of your earlier requests word for word; otherwise it builds a new one. Build always builds: a new scraper, or a new version of the one you already have for this request. Re-run only runs a saved scraper and never builds; use it for scheduled Tasks.

## `rebuildMethod` (type: `string`):

Used when the Actor rebuilds a scraper you already have. Fresh build starts from scratch. Repair starts from your current scraper and fixes what stopped working, which can help after a website change. Either way the result is a new version with the same scraper ID, so your Tasks keep working. If the new version fails the check, the current one stays and nothing is charged.

## `maxResults` (type: `integer`):

The most rows to save. Each saved row is charged as one result.

## Actor input object example

```json
{
  "prompt": "Get book titles and prices from https://books.toscrape.com/.",
  "url": "https://books.toscrape.com/",
  "mode": "auto",
  "rebuildMethod": "fresh",
  "maxResults": 100
}
```

# Actor output Schema

## `rows` (type: `string`):

Rows in the default dataset. Fields vary by saved scraper.

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

OUTPUT record: scraperId, version, action, fields, inputs, inputValues, rowsSaved, charges, and, when a scraper is saved, rerunInput and rerunHint.

# 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 = {
    "prompt": "Get book titles and prices from https://books.toscrape.com/.",
    "url": "https://books.toscrape.com/"
};

// Run the Actor and wait for it to finish
const run = await client.actor("stefanie-rink/ai-scraper-builder").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 = {
    "prompt": "Get book titles and prices from https://books.toscrape.com/.",
    "url": "https://books.toscrape.com/",
}

# Run the Actor and wait for it to finish
run = client.actor("stefanie-rink/ai-scraper-builder").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 '{
  "prompt": "Get book titles and prices from https://books.toscrape.com/.",
  "url": "https://books.toscrape.com/"
}' |
apify call stefanie-rink/ai-scraper-builder --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,stefanie-rink/ai-scraper-builder"
        }
    }
}
```

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/6VahxM6VsjSvu7hOc/builds/gxmdHWP20yYFSjHxc/openapi.json
