# AI Scraper Input Generator (`dtrungtin/ai-scraper-input-generator`) Actor

This Actor turns a natural-language prompt (e.g., “wireless noise-canceling headphones under $200”) into multiple search URLs for e-commerce sites like eBay or Amazon. It returns the URLs as ready-to-run input for Apify scrapers, enabling seamless Actor chaining and automation.

- **URL**: https://apify.com/dtrungtin/ai-scraper-input-generator.md
- **Developed by:** [Tin](https://apify.com/dtrungtin) (community)
- **Categories:** AI
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.20 / actor start

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 a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.md):

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

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.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/platform/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

### What does AI Scraper Input Generator do?

This Actor takes a natural language prompt (for example: "wireless noise-canceling headphones under $200") and uses OpenAI to generate **the requested number of search URLs** for a target e-commerce website such as [eBay](https://www.ebay.com/) or [Amazon](https://www.amazon.com/). It then packages those URLs as a ready-to-run **input for another Apify scraper**, so you can chain it straight into an Actor such as [eBay Items Scraper](https://apify.com/dtrungtin/ebay-items-scraper).

Because it runs on Apify, you get API access, scheduling, monitoring, dataset outputs, and easy integrations (Make, Zapier, webhooks, and more) without building your own infrastructure.

### Why use AI Scraper Input Generator?

- Turn unstructured user intent into a ready-to-run scraper input.
- Generate multiple targeted search-URL variations from one request.
- Feed downstream Apify scrapers directly, with no manual URL building.
- Run on schedule and trigger downstream systems with predictable JSON output.
- Keep logic in one place instead of duplicating prompt-to-URL rules across apps.

### How to use AI Scraper Input Generator

1. Open the Actor in Apify Console.
2. Set the `OPENAI_API_KEY` environment variable in the Actor settings (Settings → Environment variables, mark it as secret). For local runs, put it in a `.env` file in the project root.
3. Enter a plain-English prompt in the Input tab.
4. Set `targetActor` - the Actor that will consume the generated URLs (for example `dtrungtin/ebay-items-scraper`).
5. Optional: set `numberOfUrls` and `websiteDomain` (for example `www.ebay.com` or `www.amazon.com`). If you leave `websiteDomain` empty, it is inferred from the target Actor's example start URLs, or guessed by AI from the target Actor's details when no example URLs exist.
6. Run the Actor.
7. Open the Output tab or Dataset API URL to retrieve the generated URLs.

### Input

Set input in the Actor Input tab.

```json
{
    "prompt": "used mirrorless camera body in excellent condition",
    "targetActor": "https://apify.com/dtrungtin/ebay-items-scraper",
    "numberOfUrls": 3
}
````

Field notes:

- `prompt` (required): user intent to transform into search URLs.
- `targetActor` (required): Actor that will consume the generated URLs, as a full Apify Store URL (`https://apify.com/dtrungtin/ebay-items-scraper`) or a path (`dtrungtin/ebay-items-scraper`).
- `numberOfUrls` (optional): how many search URLs to generate, 1-50 (default 3).
- `websiteDomain` (optional): target website domain, e.g. `www.ebay.com`, `www.ebay.co.uk`, or `www.amazon.com`. If left empty, it is inferred from the target Actor's example start URLs, and if those are missing, guessed by AI from the target Actor's name, title, and description. This selects the *site*; if your prompt names a specific country, the generated URLs may use that country's regional domain of the same site (for example a UK-focused prompt can produce `www.ebay.co.uk` URLs even when `websiteDomain` is `www.ebay.com`).

The OpenAI API key is not part of the input. It is read from the `OPENAI_API_KEY` environment variable (Actor Settings → Environment variables in Apify Console, or a local `.env` file).

### Output

The Actor stores one dataset item per generated URL. The `OUTPUT` record in the key-value store is a complete, ready-to-run input for the Actor set in `targetActor` (for example [eBay Items Scraper](https://apify.com/dtrungtin/ebay-items-scraper)) - you can pass it directly as the input of that Actor (for example in an Actor-to-Actor integration or `Actor.call()`). It is built from the target Actor's example input - filtered to only the fields that belong to that Actor's input schema, so leftover template placeholders are dropped - with `startUrls` set to the generated URLs.

Dataset items:

```json
[
    { "url": "https://www.ebay.com/sch/i.html?_nkw=used+mirrorless+camera+body+excellent+condition" },
    { "url": "https://www.ebay.com/sch/i.html?_nkw=mirrorless+camera+body+preowned+excellent" },
    { "url": "https://www.ebay.com/sch/i.html?_nkw=used+mirrorless+camera+body+clean+condition" }
]
```

`OUTPUT` key-value store record:

```json
{
    "startUrls": [
        { "url": "https://www.ebay.com/sch/i.html?_nkw=used+mirrorless+camera+body+excellent+condition" },
        { "url": "https://www.ebay.com/sch/i.html?_nkw=mirrorless+camera+body+preowned+excellent" },
        { "url": "https://www.ebay.com/sch/i.html?_nkw=used+mirrorless+camera+body+clean+condition" }
    ],
    "proxyConfig": {
        "useApifyProxy": true,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "VN"
    }
}
```

You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

### Data table

| Field | Type | Description |
| --- | --- | --- |
| url | string | Generated search URL |

### Supported websites

- **eBay** (any regional domain, e.g. `www.ebay.com`, `www.ebay.co.uk`, `www.ebay.de`): URLs use `/sch/i.html?_nkw=...` and may include filters such as buy-it-now, condition, or seller type.
- **Amazon** (any regional domain, e.g. `www.amazon.com`, `www.amazon.de`): URLs use `/s?k=...`.
- **Other websites**: URLs are validated generically - they must be HTTPS URLs on the requested domain with search query parameters. Results depend on how well the model knows the website's search URL format.

### Pricing / Cost estimation

How much does it cost to generate search URLs? Usually very little. Total cost is mainly driven by:

- OpenAI token usage (depends on prompt length)
- Apify compute units consumed by a short Actor run

For most simple prompts, this Actor completes quickly and stays within low usage ranges. If you are on Apify free tier, you can test with a small number of runs before scaling.

### Tips or Advanced options

- Keep prompts specific (brand, condition, budget, category) to get better URLs.
- Add this Actor to a scheduled task to auto-generate fresh search links daily.
- Pass URLs to another Actor for listing extraction, price checks, or alerts.
- To target a regional marketplace, either set `websiteDomain` to that domain (e.g. `www.ebay.co.uk`) or mention the country in the prompt.

### FAQ, disclaimers, and support

This Actor generates search URLs only. It does not guarantee listing availability, ranking order, or marketplace-specific policy outcomes. Always review and comply with the target website's terms and applicable laws before using generated URLs in automated workflows.

Known limitations:

- Requires a valid OpenAI API key in the `OPENAI_API_KEY` environment variable.
- Output quality depends on prompt clarity.
- Enforces the exact requested number of unique URLs and may fail if model output is invalid.

Need help or a custom version? Open an issue in the Actor repository or request a tailored implementation for your workflow.

# Actor input Schema

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

Describe what the user wants to search for on the target website. The Actor will generate the requested number of search URLs.

## `numberOfUrls` (type: `integer`):

How many search URLs to generate.

## `targetActor` (type: `string`):

Actor that will consume the generated URLs. Accepts a full Apify Store URL (https://apify.com/dtrungtin/ebay-items-scraper) or a path (dtrungtin/ebay-items-scraper). The OUTPUT record is saved as a ready-to-run input for this Actor.

## `websiteDomain` (type: `string`):

Optional. Target website domain for generated search URLs, e.g. www.ebay.com, www.ebay.co.uk, or www.amazon.com. If left empty, it is inferred from the target Actor's example start URLs.

## Actor input object example

```json
{
  "prompt": "gaming laptop under 1000 USD with RTX 4060",
  "numberOfUrls": 3,
  "targetActor": "dtrungtin/ebay-items-scraper"
}
```

# 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": "gaming laptop under 1000 USD with RTX 4060",
    "targetActor": "dtrungtin/ebay-items-scraper"
};

// Run the Actor and wait for it to finish
const run = await client.actor("dtrungtin/ai-scraper-input-generator").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": "gaming laptop under 1000 USD with RTX 4060",
    "targetActor": "dtrungtin/ebay-items-scraper",
}

# Run the Actor and wait for it to finish
run = client.actor("dtrungtin/ai-scraper-input-generator").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 '{
  "prompt": "gaming laptop under 1000 USD with RTX 4060",
  "targetActor": "dtrungtin/ebay-items-scraper"
}' |
apify call dtrungtin/ai-scraper-input-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=dtrungtin/ai-scraper-input-generator",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "AI Scraper Input Generator",
        "description": "This Actor turns a natural-language prompt (e.g., “wireless noise-canceling headphones under $200”) into multiple search URLs for e-commerce sites like eBay or Amazon. It returns the URLs as ready-to-run input for Apify scrapers, enabling seamless Actor chaining and automation.",
        "version": "0.0",
        "x-build-id": "Gewa7yRbmrTTfa0Kz"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/dtrungtin~ai-scraper-input-generator/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-dtrungtin-ai-scraper-input-generator",
                "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/dtrungtin~ai-scraper-input-generator/runs": {
            "post": {
                "operationId": "runs-sync-dtrungtin-ai-scraper-input-generator",
                "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/dtrungtin~ai-scraper-input-generator/run-sync": {
            "post": {
                "operationId": "run-sync-dtrungtin-ai-scraper-input-generator",
                "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": [
                    "prompt",
                    "targetActor"
                ],
                "properties": {
                    "prompt": {
                        "title": "Prompt",
                        "type": "string",
                        "description": "Describe what the user wants to search for on the target website. The Actor will generate the requested number of search URLs.",
                        "default": "gaming laptop under 1000 USD with RTX 4060"
                    },
                    "numberOfUrls": {
                        "title": "Number of URLs",
                        "minimum": 1,
                        "maximum": 30,
                        "type": "integer",
                        "description": "How many search URLs to generate.",
                        "default": 3
                    },
                    "targetActor": {
                        "title": "Target Actor",
                        "type": "string",
                        "description": "Actor that will consume the generated URLs. Accepts a full Apify Store URL (https://apify.com/dtrungtin/ebay-items-scraper) or a path (dtrungtin/ebay-items-scraper). The OUTPUT record is saved as a ready-to-run input for this Actor."
                    },
                    "websiteDomain": {
                        "title": "Website Domain",
                        "type": "string",
                        "description": "Optional. Target website domain for generated search URLs, e.g. www.ebay.com, www.ebay.co.uk, or www.amazon.com. If left empty, it is inferred from the target Actor's example start 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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
