# Grocery Unit Price & Weight Comparison Scraper (`moving_beacon-owner1/grocery-unit-price-weight-comparison-scraper`) Actor

An Apify Actor extracts grocery products, packaging details, and prices, calculating normalized unit pricing ($/100g or 100ml) for better price comparisons. It removes confusion from multi-packs and varied weight units, providing a standardized baseline for true grocery cost comparisons.

- **URL**: https://apify.com/moving_beacon-owner1/grocery-unit-price-weight-comparison-scraper.md
- **Developed by:** [Jamshaid Arif](https://apify.com/moving_beacon-owner1) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $9.99 / 1,000 results

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

## Grocery Unit Price & Weight Comparison Scraper

An Apify Actor that extracts retail grocery products, packaging specifications, and retail prices, then automatically calculates **normalized unit pricing ($/100g or 100ml)** across all items for accurate price and value comparison.

Ported and enhanced from retail grocery scrapers , this Actor eliminates the confusion caused by multi-packs, varied weight units (kg, g, lb, oz, L, ml), and bulk sizing, giving you a standardized baseline for comparing true grocery costs.

***

### Features

- **Standardized Unit Pricing**: Computes exact normalized cost per 100 grams (`$/100g`) for apples-to-apples price comparisons across different package sizes.
- **Multi-Pack & Complex Size Parsing**: Automatically parses expressions like `6 x 213 g`, `2 x 1 kg`, `12 x 284 ml`, `8 x 500 g`, and imperial measures (`2.26 kg`, `1.36 kg / 3 lb`, `28.35 g / 1 oz`).
- **Comprehensive Unit Normalization**: Converts metric mass (`kg`, `g`), volume equivalents (`L`, `ml`), and imperial weights (`oz`, `lb`) into standardized grams.
- **Dual-Mode Reliability (Live & Offline)**: Attempts live extraction with browser TLS impersonation (`curl-cffi`), and seamlessly falls back to a curated catalog of 25+ grocery staples when offline or running in isolated network environments.
- **Fast & Keyless**: No browser binaries or API tokens required; low memory footprint and high throughput.

***

### Use Cases

1. **Price & Value Comparison**: Identify whether bulk purchases (e.g. at Costco or wholesale clubs) truly offer a lower unit price compared to retail grocers.
2. **Shrinkflation Tracking**: Monitor changes in net package weight versus shelf price over time to detect stealth price increases.
3. **Budget & Meal Planning**: Find the most cost-effective ingredients per 100g across categories like Pantry, Canned Goods, Breakfast, and Proteins.
4. **Market Intelligence & Retail Analytics**: Benchmark competitor pricing and package assortment across national supermarket brands.

***

### Input Parameters

| Field | Type | Default | Description |
|---|---|---|---|
| `query` | `string` | `"grocery"` | Search keyword or item name (e.g. `quinoa`, `salmon`, `coffee`, `peanut butter`, `olive oil`, or `all`). |
| `category` | `string \| null` | `null` | Optional grocery category filter (e.g. `Pantry`, `Canned Goods`, `Breakfast`, `Snacks & Nuts`, `Coffee & Tea`, `Pasta & Noodles`, `Oils & Vinegars`). |
| `max_records` | `integer` | `20` | Maximum number of grocery items to extract and save to the dataset. |
| `max_pages` | `integer` | `1` | Maximum number of listing pages to crawl. |
| `proxy_configuration` | `object` | `{}` | Optional Apify Proxy configuration to route HTTP requests. |

#### Example Inputs

##### 1. General Grocery Search (Default)

```json
{
  "query": "grocery",
  "max_records": 20
}
```

##### 2. Specific Item Search (Salmon)

```json
{
  "query": "salmon",
  "max_records": 10
}
```

##### 3. Category Filtered (Breakfast)

```json
{
  "query": "cereal",
  "category": "Breakfast",
  "max_records": 15
}
```

***

### Output Dataset Schema

Each record saved to the Apify dataset contains normalized grocery item details:

| Field | Type | Example | Description |
|---|---|---|---|
| `name` | `string` | `"Kirkland Signature Organic Quinoa, 2.04 kg"` | Full product name with packaging weight specification. |
| `title` | `string` | `"Kirkland Signature Organic Quinoa, 2.04 kg"` | Product title. |
| `price` | `number` | `11.99` | Retail purchase price. |
| `currency` | `string` | `"USD"` | ISO 4217 currency code. |
| `unit_price` | `string` | `"$0.59 /100 g"` | Formatted normalized unit price per 100 grams. |
| `unit_price_per_100g` | `number` | `0.59` | Numeric normalized unit cost per 100 grams. |
| `amount_grams` | `number` | `2040.0` | Total net product quantity normalized to grams. |
| `brand` | `string \| null` | `"Kirkland Signature"` | Brand or manufacturer. |
| `category` | `string \| null` | `"Pantry"` | Grocery aisle or category classification. |
| `source` | `string` | `"costco.com"` | Source retail domain. |
| `url` | `string` | `"https://www.costco.com/..."` | Store or product URL. |
| `query` | `string` | `"quinoa"` | Search query keyword used. |
| `position` | `integer` | `1` | Rank position in results. |
| `scraped_at` | `string` | `"2026-11-19T12:00:00+00:00"` | ISO 8601 UTC timestamp of data collection. |

#### Sample Output Record

```json
{
  "name": "Kirkland Signature Organic Quinoa, 2.04 kg",
  "title": "Kirkland Signature Organic Quinoa, 2.04 kg",
  "price": 11.99,
  "currency": "USD",
  "unit_price": "$0.59 /100 g",
  "unit_price_per_100g": 0.59,
  "amount_grams": 2040.0,
  "brand": "Kirkland Signature",
  "category": "Pantry",
  "source": "costco.com",
  "url": "https://www.costco.com/kirkland-signature-organic-quinoa-2.04-kg.product.100381414.html",
  "query": "quinoa",
  "position": 1,
  "scraped_at": "2026-11-19T12:00:00+00:00"
}
```

```json
{
  "name": "Ocean's Wild Pink Salmon, 6 x 213 g",
  "title": "Ocean's Wild Pink Salmon, 6 x 213 g",
  "price": 14.99,
  "currency": "USD",
  "unit_price": "$1.17 /100 g",
  "unit_price_per_100g": 1.17,
  "amount_grams": 1278.0,
  "brand": "Ocean's",
  "category": "Canned Goods",
  "source": "costco.com",
  "url": "https://www.costco.com/oceans-wild-pink-salmon-6-x-213-g.product.100412345.html",
  "query": "salmon",
  "position": 2,
  "scraped_at": "2026-11-19T12:00:00+00:00"
}
```

***

### Policy & Responsible Use

This Actor is designed to collect publicly accessible grocery product information and retail pricing data from supported online grocery retailers for legitimate price comparison, consumer research, market analysis, and retail intelligence.

- **Public Data Only:** The Actor is intended to collect publicly accessible product information, including product names, brands, retail prices, packaging sizes, product weights, categories, product URLs, and other publicly displayed product attributes. It does not require private customer credentials or account authentication.
- **Respect Website Rules:** Users are responsible for complying with the applicable Terms of Service, website policies, and access restrictions of each supported grocery retailer, including Costco and other third-party retail websites.
- **Rate Limiting:** Configurable record and pagination limits, together with optional proxy configuration, support controlled data collection and help reduce unnecessary requests to retailer websites.
- **No Security Circumvention:** The Actor is not designed to bypass authentication, access private customer information, defeat security mechanisms, or circumvent technical access restrictions.
- **Responsible Price Comparison:** Calculated unit prices are intended to support grocery budgeting, product comparisons, bulk purchasing decisions, and retail market research. Users should verify displayed prices, package quantities, and product specifications directly with the retailer before making purchasing decisions.
- **Unit Conversion Accuracy:** The Actor normalizes supported metric and imperial package measurements into grams for standardized comparison. Volume-based products measured in liters or milliliters should be compared using appropriate volume-based measurements rather than assuming that volume and mass are interchangeable.
- **Data Accuracy:** Product prices, package sizes, discounts, availability, and product descriptions may change without notice. The Actor does not guarantee that extracted information or calculated unit prices are complete, current, or accurate.
- **Offline Fallback Data:** When offline fallback fixtures are used, the resulting records may contain sample or predefined catalog information rather than live retailer data. Users should verify the source and freshness of records before relying on them.
- **Intellectual Property:** Product images, descriptions, brand names, logos, trademarks, and other protected website content remain the property of their respective owners. Users must obtain any necessary permissions before reproducing or commercially redistributing protected materials.
- **User Responsibility:** Users are solely responsible for ensuring that their collection, storage, processing, comparison, redistribution, and commercial use of extracted information comply with applicable laws, regulations, privacy requirements, and third-party website policies.

**Disclaimer:** This Actor is an independent grocery data extraction and unit-price comparison tool. It is not affiliated with, endorsed by, or officially associated with Costco or any other supported grocery retailer. All retailer names, trademarks, logos, product images, and website content belong to their respective owners.

# Actor input Schema

## `query` (type: `string`):

Grocery search term or item name (e.g. 'quinoa', 'salmon', 'coffee', 'peanut butter', 'olive oil', or 'all').

## `category` (type: `string`):

Optional grocery category filter (e.g. 'Pantry', 'Canned Goods', 'Breakfast', 'Snacks & Nuts', 'Coffee & Tea', 'Pasta & Noodles', 'Oils & Vinegars').

## `max_records` (type: `integer`):

Maximum number of grocery items to extract.

## `max_pages` (type: `integer`):

Maximum number of catalog or search pages to crawl.

## `proxy_configuration` (type: `object`):

Optional Apify proxy configuration for routing HTTP requests.

## Actor input object example

```json
{
  "query": "grocery",
  "max_records": 20,
  "max_pages": 1
}
```

# Actor output Schema

## `results` (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 = {
    "query": "grocery",
    "max_records": 20,
    "max_pages": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("moving_beacon-owner1/grocery-unit-price-weight-comparison-scraper").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 = {
    "query": "grocery",
    "max_records": 20,
    "max_pages": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("moving_beacon-owner1/grocery-unit-price-weight-comparison-scraper").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 '{
  "query": "grocery",
  "max_records": 20,
  "max_pages": 1
}' |
apify call moving_beacon-owner1/grocery-unit-price-weight-comparison-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,moving_beacon-owner1/grocery-unit-price-weight-comparison-scraper"
        }
    }
}
```

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/JUj7GbgnMOdsEMfG3/builds/EbxVbWaNJ4ncZSx8A/openapi.json
