# Price Detector (Experimental) (`equidem/price-detector-experimental`) Actor

- **URL**: https://apify.com/equidem/price-detector-experimental.md
- **Developed by:** [Matěj Sochor](https://apify.com/equidem) (community)
- **Categories:** E-commerce
- **Stats:** 72 total users, 0 monthly users, 0.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## 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

## Price Detector (Experimental)

This actor implements a price detection AI model. Given a snapshot of a product detail webpage,
it will try to find the current price and the original price (if the product was discounted).
The current measured accuracy is around 95%.

Please note that this release is experimental, which is why its usage is restricted to those with our permission.
If you want to use it, email matej@apify.com.
Also, the detector is constrained to EU currencies and USD at this point. It will likely not work well for webpages containing other currencies.

### Input

There are two ways to input the product details webpage snapshots into the actor:
(for an explanation of the specific attributes, see below)

1. If you only want to detect price in a single webpage:

   ```json
   {
      "restrictionPassword": "...",
      "html": "8f24f3cdbd09780884108c2ed43bd0e4240dfd43a553779b55815c2b2a144cf0.html",
      "kvStoreId": "RexjDmnTvJcAuWLZn",
      "mhtml": "8f24f3cdbd09780884108c2ed43bd0e4240dfd43a553779b55815c2b2a144cf0.mhtml",
      "url": "https://stayclassy.no/collections/black-friday-rekord-lave-priser-i-hele-november/products/classywalk-spirallas-med-nokkel"
   }
   ```

2. If you need to detect it in multiple webpages in one run:

   ```json
   {
      "restrictionPassword": "...",
      "webpages": [
          {
              "html": "8f24f3cdbd09780884108c2ed43bd0e4240dfd43a553779b55815c2b2a144cf0.html",
              "kvStoreId": "RexjDmnTvJcAuWLZn",
              "mhtml": "8f24f3cdbd09780884108c2ed43bd0e4240dfd43a553779b55815c2b2a144cf0.mhtml",
              "url": "https://stayclassy.no/collections/black-friday-rekord-lave-priser-i-hele-november/products/classywalk-spirallas-med-nokkel"
          },
          {
              "url": "https://www.rdveikals.lv/products/lv/1675/451049/sort/5/filter/0_0_0_0/Dz%C4%ABv%C5%BEogu-%C5%A1%C4%B7%C4%93res-54.4-Instruments.html",
              "kvStoreId": "RO7fsSWGF9Q0gArn6",
              "html": "ee5f837b7d863a32d6088efac8433e7d3b976a8ca7ca17b6adcb5196e75830e9.html",
              "mhtml": "ee5f837b7d863a32d6088efac8433e7d3b976a8ca7ca17b6adcb5196e75830e9.mhtml"
          }
      ]
   }
   ```

As you can see, there are five input attributes:

1. **restrictionPassword** - a password required for the actor to run
2. **kvStoreId** - Id of the key value store that contains the html and mhtml snapshots (due to size restrictions, the snapshots themselves cannot be passed in the input and need to be passed through another key value store)
3. **url** - URL of the webpage being processed
4. **html** - Key to a record in the snapshot key value store that contains the page's HTML snapshot
5. **mhtml** - Key to a record in the snapshot key value store that contains the page's MHTML snapshot

### Output

Outputs are put into the default dataset of the actor run, with each row corresponding to one of the webpages on the input.
Each of those rows looks like this:

```json
{
   "url": "https://stayclassy.no/collections/black-friday-rekord-lave-priser-i-hele-november/products/classywalk-spirallas-med-nokkel",
   "currentPrice": 49,
   "referralPrice": 236,
   "currency": "NOK"
}
```

Where:

1. **url** is the webpage's url from the input
2. **currentPrice** is the price the products currently sells for
3. **referralPrice** is the price before discount (when the product is discounted)
4. **currency** is the currency (if it can be determined)

# Actor input Schema

## `restrictionPassword` (type: `string`):

A password needed to run the actor due to it being in a restricted experimental mode. If you want to try the actor, write to matej@apify.com

## `kvStoreId` (type: `string`):

Id of the key value store that contains the html and mhtml snapshots

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

URL of the product page

## `html` (type: `string`):

Key to a record in the snapshot key value store that contains the page's HTML snapshot

## `mhtml` (type: `string`):

Key to a record in the snapshot key value store that contains the page's MHTML snapshot

## `webpages` (type: `array`):

Use when you want to detect price in multiple webpages in one run. It should be an array of objects containing the previous four attributes. Overrides the other inputs if present.

## Actor input object example

```json
{
  "url": "https://www.directcosmetics.com/shop/product/79990"
}
```

# 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 = {
    "url": "https://www.directcosmetics.com/shop/product/79990"
};

// Run the Actor and wait for it to finish
const run = await client.actor("equidem/price-detector-experimental").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 = { "url": "https://www.directcosmetics.com/shop/product/79990" }

# Run the Actor and wait for it to finish
run = client.actor("equidem/price-detector-experimental").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 '{
  "url": "https://www.directcosmetics.com/shop/product/79990"
}' |
apify call equidem/price-detector-experimental --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,equidem/price-detector-experimental"
        }
    }
}
```

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/O3LLBcdtQJpgdecLM/builds/TCvazim2sKcoqJTTO/openapi.json
