# 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
- **Features:** Limited permissions
- **Stats:** 12 total users, 3 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $2.49 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## 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": 5,
  "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(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": "laptop",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call scrapeai/walmart-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapeai/walmart-search-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/QhodLPLsAtJ2dHjG9/builds/rKXapS5nXfsaCa2OX/openapi.json
