# Price comparison (`harsh-dev/price-comparison`) Actor

Compares prices for products across merchants using Google Shopping results from the automation-lab/google-shopping-scraper Actor.

- **URL**: https://apify.com/harsh-dev/price-comparison.md
- **Developed by:** [Harshavardhan Shinde](https://apify.com/harsh-dev) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 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 comparison

Compare product prices across merchants and find deals. The Actor searches Google Shopping
for each query, groups the merchant offers per product, and reports the cheapest offer,
the price spread, and whether any offer is on sale.

### How it works

1. You give it one or more product search queries (for example `wireless earbuds`).
2. It calls the Store Actor [`automation-lab/google-shopping-scraper`](https://apify.com/automation-lab/google-shopping-scraper),
   which reads publicly listed Google Shopping results.
3. It groups offers by product title and writes one comparison row per product to the dataset.

### Input

| Field | Description |
| --- | --- |
| `queries` | Product search terms. Each one runs a separate search. |
| `maxResults` | Max product listings per query. Default 10, kept low to control cost. |
| `country` / `language` | Two-letter codes for localized results (for example `us`, `en`). |
| `minPrice` / `maxPrice` | Optional price range in the local currency. |
| `onSale` / `freeShipping` | Optional filters for discounted or free-shipping offers. |

### Output

One row per product in the default dataset: `product`, `cheapestPrice`, `currency`,
`cheapestMerchant`, `cheapestUrl`, `offerCount`, `priceSpread`, `onSale`, and the full
`offers` list.

### Legal and compliance notes

- The Actor only reads publicly visible search results. It does not log in, bypass paywalls,
  or access private accounts.
- It collects product and price data, not personal data about individuals.
- Prices and offers are displayed as found. Check the merchant's page before buying.
- Use the data for comparison and research. Respect each merchant's terms if you republish it.
- Keep request volume reasonable. Use scheduled runs at sensible intervals rather than
  high-frequency polling.

# Actor input Schema

## `queries` (type: `array`):

Product names to search on Google Shopping, for example "wireless earbuds" or "4k monitor". Each query is a separate search.

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

Maximum number of offers to collect per query. Keep it small while testing, because each result is billed.

## `country` (type: `string`):

Two-letter country code for localized prices, for example us, gb, de.

## `language` (type: `string`):

Two-letter language code for product titles, for example en, de.

## `minPrice` (type: `number`):

Only include offers at or above this price, in local currency. Leave empty for no minimum.

## `maxPrice` (type: `number`):

Only include offers at or below this price, in local currency. Leave empty for no maximum.

## `onSale` (type: `boolean`):

Only return offers that Google shows with a discount.

## `freeShipping` (type: `boolean`):

Only return offers with free shipping.

## Actor input object example

```json
{
  "queries": [
    "wireless earbuds"
  ],
  "maxResults": 10,
  "country": "us",
  "language": "en",
  "onSale": false,
  "freeShipping": false
}
```

# Actor output Schema

## `comparison` (type: `string`):

No description

# 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 = {
    "queries": [
        "wireless earbuds"
    ],
    "maxResults": 10,
    "country": "us",
    "language": "en"
};

// Run the Actor and wait for it to finish
const run = await client.actor("harsh-dev/price-comparison").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 = {
    "queries": ["wireless earbuds"],
    "maxResults": 10,
    "country": "us",
    "language": "en",
}

# Run the Actor and wait for it to finish
run = client.actor("harsh-dev/price-comparison").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 '{
  "queries": [
    "wireless earbuds"
  ],
  "maxResults": 10,
  "country": "us",
  "language": "en"
}' |
apify call harsh-dev/price-comparison --silent --output-dataset

```

## MCP server setup

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

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/LdGTE6F4pFOu21ayH/builds/vOO5db07dQggtRi7c/openapi.json
