# Walmart Search Scraper (`scrapeai/walmart-search-scraper`) Actor

Scrapes product listings from Walmart search results including title, price, rating, reviews, seller, and more.

- **URL**: https://apify.com/scrapeai/walmart-search-scraper.md
- **Developed by:** [ScrapeAI](https://apify.com/scrapeai) (community)
- **Categories:** E-commerce, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $15.00 / 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/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

## Walmart Search Scraper 🛍️

A high-performance **Walmart product scraper** built with **Playwright** and the **Apify SDK**. Scrapes Walmart search results and extracts complete product data including list page information and detailed product specifications from individual product pages.

### Features ✨

- 🔍 Search Walmart using keywords with flexible search URLs
- 📋 Extract product list data: position, title, price, rating, review count, thumbnail, and link
- 🔗 Automatic tracking URL decoding for `/sp/track?rd=...` links
- 📄 Deep product detail extraction from individual product pages
- 📊 Complete product data merge: list data + detail specifications
- ⚡ Multi-page pagination support with configurable item limits
- 🔄 Auto-retry on failed requests (up to 2 retries per URL)
- 🌐 Proxy rotation using Apify Proxy (optional)
- 💾 Redux state extraction for accurate detail data
- 🖼️ Image collection from product pages (up to 40 per product)
- ⭐ Rating and review count extraction from aria-labels
- 📤 Dataset output compatible with JSON, CSV, and Excel export via Apify
- 👻 Headless browser support (configurable)

### How It Works 🛠️

1. Set your search URLs and parameters in the Actor input
2. The scraper navigates to Walmart search result pages
3. Extracts product list items
4. Stores list data temporarily in memory
5. Navigates to each product detail page (up to `maxItems`)
6. Extracts product specifications from Redux state and DOM
7. Merges list + detail data and outputs complete product records
8. Handles pagination automatically until reaching `maxItems` limit

### Input Parameters 📝

| Parameter | Type | Description | Default |
|-----------|------|-------------|---------|
| `startUrls` | object[] | Array of URLs to search (e.g., `https://www.walmart.com/search?q=laptop`) | Required |
| `maxItems` | integer | Maximum products to extract per search | `50` |
| `includeDetails` | boolean | Extract detailed product information from detail pages | `true` |
| `proxyConfiguration` | object | Apify proxy config (groups, country, etc.) | Optional |

#### Input Example

```json
{
  "startUrls": [
    {
      "url": "https://www.walmart.com/search?q=laptop"
    },
    {
      "url": "https://www.walmart.com/search?q=gaming+monitor"
    }
  ],
  "maxItems": 50,
  "includeDetails": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"]
  }
}
````

### Output 📊

Each product result is saved as a separate dataset item with merged list and detail data.

| Field | Description |
|-------|-------------|
| `position` | Product rank/position on search page (1-based) |
| `title` | Product title from search result |
| `price` | Product price from detail page (finalPrice) |
| `rating` | Average rating (e.g., 4.5) |
| `reviewCount` | Total number of reviews |
| `link` | Original tracking URL from search result |
| `thumbnail` | Product thumbnail image URL |
| `listPageUrl` | The search page URL |
| `productUrl` | Decoded product detail page URL |
| `details` | Object containing detailed product information |

#### Details Object

| Field | Description |
|-------|-------------|
| `title` | Full product title from detail page |
| `brand` | Product brand/manufacturer |
| `model` | Product model number/name |
| `finalPrice` | Product price with formatting |
| `rating` | Average star rating |
| `reviewCount` | Number of customer reviews |
| `availability` | Stock status (In stock / Out of stock) |
| `description` | Product description text |
| `sellerName` | Selling merchant name |
| `shippingInfo` | Shipping details |
| `returnPolicy` | Return policy text |
| `highlights` | Array of product highlights/features |
| `specifications` | Object of product specifications |
| `images` | Array of product image URLs (up to 40) |
| `rawReduxExists` | Boolean indicating if Redux data was available |

#### Output Example

```json
{
  "position": 1,
  "title": "Lenovo IdeaPad 5 16\" Touchscreen 2-in-1 Laptop",
  "price": "$679.00",
  "rating": 4.5,
  "reviewCount": 730,
  "link": "https://www.walmart.com/sp/track?rd=...",
  "thumbnail": "https://i5.walmartimages.com/seo/product-image.jpeg",
  "listPageUrl": "https://www.walmart.com/search?q=laptop",
  "productUrl": "https://www.walmart.com/ip/Lenovo-IdeaPad-5-16-Touchscreen-2-in-1-Laptop-Ryzen-7-16GB-1TB-SSD-83DS0056US/13186557746",
  "details": {
    "title": "Lenovo IdeaPad 5 16\" Touchscreen 2-in-1 Laptop, Ryzen 7, 16GB, 1TB SSD",
    "brand": "Lenovo",
    "model": "IdeaPad 5",
    "finalPrice": "$679.00",
    "rating": 4.5,
    "reviewCount": 730,
    "availability": "In stock",
    "description": "Powerful performance with AMD Ryzen processor...",
    "sellerName": "Walmart",
    "shippingInfo": "Free 2-day shipping on orders over $35",
    "returnPolicy": "Free 30-day returns",
    "highlights": [
      "16-inch FHD touchscreen display",
      "AMD Ryzen 7 processor",
      "16GB RAM for multitasking",
      "1TB SSD for fast storage"
    ],
    "specifications": {
      "Processor": "AMD Ryzen 7",
      "RAM": "16GB",
      "Storage": "1TB SSD",
      "Display": "16-inch FHD"
    },
    "images": [
      "https://i5.walmartimages.com/asr/image1.jpeg",
      "https://i5.walmartimages.com/asr/image2.jpeg"
    ],
    "rawReduxExists": true
  }
}
```

### Proxy Configuration 🌐

For best results, use the **RESIDENTIAL** proxy group to avoid blocks:

```json
{
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"]
  }
}
```

> Note: When running locally, Apify Proxy requires a proxy password or an `APIFY_TOKEN` environment variable.

### Use Cases 💡

- 🛒 E-commerce price monitoring and competitor analysis
- 📊 Product data aggregation and catalog building
- 💰 Price comparison and market research
- 📈 Trend analysis on product availability and ratings
- 🏷️ Deal discovery and price tracking
- 📱 Mobile app data feeds
- 🤖 Machine learning datasets for product classification

### Anti-Detection Measures 🛡️

- Masks `navigator.webdriver` to avoid bot detection
- Uses Apify RESIDENTIAL proxies for real IP rotation
- Random delays between scroll and navigation actions
- Blocks heavy media resources to reduce fingerprint
- Automatic retry on timeout or network errors
- Session rotation on repeated failures

### Running Locally

```bash
## Install dependencies
npm install

## Run the scraper
npm start
```

Reads input from [INPUT.json](INPUT.json) when no Actor input is provided.

#### INPUT.json Example

```json
{
  "startUrls": [
    {
      "url": "https://www.walmart.com/search?q=laptop"
    }
  ],
  "maxItems": 50,
  "includeDetails": true
}
```

# Actor input Schema

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

The search term to look for on Walmart.

## `maxItems` (type: `integer`):

Maximum number of product items to scrape.

## `sortBy` (type: `string`):

Sort order for search results.

## `proxyConfiguration` (type: `object`):

Proxy configuration used by the scraper.

## Actor input object example

```json
{
  "query": "laptop",
  "maxItems": 50,
  "sortBy": "best_match",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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": "laptop",
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapeai/walmart-search-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": "laptop",
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("scrapeai/walmart-search-scraper").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 '{
  "query": "laptop",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call scrapeai/walmart-search-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Walmart Search Scraper",
        "description": "Scrapes product listings from Walmart search results including title, price, rating, reviews, seller, and more.",
        "version": "1.0",
        "x-build-id": "7vCG03j9YKdhUZMP2"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scrapeai~walmart-search-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scrapeai-walmart-search-scraper",
                "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/scrapeai~walmart-search-scraper/runs": {
            "post": {
                "operationId": "runs-sync-scrapeai-walmart-search-scraper",
                "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/scrapeai~walmart-search-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-scrapeai-walmart-search-scraper",
                "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": [
                    "query"
                ],
                "properties": {
                    "query": {
                        "title": "Search Query",
                        "type": "string",
                        "description": "The search term to look for on Walmart."
                    },
                    "maxItems": {
                        "title": "Max Items",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Maximum number of product items to scrape.",
                        "default": 50
                    },
                    "sortBy": {
                        "title": "Sort By",
                        "enum": [
                            "best_match",
                            "price_low",
                            "price_high",
                            "best_seller",
                            "rating"
                        ],
                        "type": "string",
                        "description": "Sort order for search results.",
                        "default": "best_match"
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Settings",
                        "type": "object",
                        "description": "Proxy configuration used by the scraper."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
