# Flipkart Scraper (`patel_dev_automation/flipkart-scraper`) Actor

Extract structured Flipkart product data - title, price, MRP, discount, rating, reviews, image, and URL - from any search or category page. Auto-paginates through all results. Clean JSON output via API.

- **URL**: https://apify.com/patel\_dev\_automation/flipkart-scraper.md
- **Developed by:** [Dev Patel](https://apify.com/patel_dev_automation) (community)
- **Categories:** E-commerce, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $3.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 web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## Flipkart Scraper

Extract structured product data from **Flipkart** search and category pages — at scale, with automatic pagination through every result page.

### What it does

Give it one or more Flipkart search/category URLs and it returns clean JSON for every product: title, price, MRP (struck price), discount, rating, rating count, image, product URL, and product ID.

- 🔎 Works with any Flipkart **search** (`/search?q=...`) or **category** (`/.../pr?sid=...`) URL
- 📄 **Auto-pagination** through all result pages (derives the real page count from the result total)
- 🛡️ **Soft-block recovery** — Flipkart throttles with empty pages (HTTP 200); the scraper re-fetches them on a fresh proxy
- 🔁 **Dedup** by product ID across all pages
- ⚡ Cheap & fast — pure HTTP + HTML parsing, no headless browser

### Input

| Field | Type | Description |
|-------|------|-------------|
| `searchUrls` | array | **Required.** Flipkart search or category URLs. Example: `https://www.flipkart.com/search?q=ghar+soaps` |
| `maxItemsPerStartUrl` | integer | Hard cap on total products per URL. Default `500`. Set high to get everything. |
| `proxyConfiguration` | object | **Residential proxies (country India) required** — Flipkart blocks datacenter IPs. Default already requests them. |

#### Example input

```json
{
    "searchUrls": [
        { "url": "https://www.flipkart.com/search?q=ghar+soaps" }
    ],
    "maxItemsPerStartUrl": 500,
    "proxyConfiguration": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"], "apifyProxyCountry": "IN" }
}
```

### Output

```json
{
    "productId": "SOPHYGFXVA3ZEPAT",
    "title": "Ghar Soaps Sandal Wood And Saffron Soap For Glowing & Radiant Skin (2 x 100 g)",
    "productUrl": "https://www.flipkart.com/ghar-soaps-.../p/itm...",
    "price": 299,
    "originalPrice": 333,
    "currency": "INR",
    "discountPercent": 10,
    "rating": 4,
    "ratingCount": 172584,
    "image": "https://rukminim2.flixcart.com/image/...jpeg",
    "scrapedFrom": "https://www.flipkart.com/search?q=ghar+soaps"
}
```

### Notes

- Flipkart blocks datacenter IPs, so **residential proxies are required** on the platform. The default config requests Apify Residential (India). If results come back empty, your proxy IPs are likely flagged — switch to a premium residential pool.
- Flipkart's CSS class names are obfuscated and rotate; this scraper extracts data using stable structural signals (`div[data-id]`, the title anchor, ₹-price regex) so it survives Flipkart's frequent markup tweaks.

# Actor input Schema

## `searchUrls` (type: `array`):

Flipkart search or category URLs to scrape. Search example: https://www.flipkart.com/search?q=ghar+soaps — Category example: https://www.flipkart.com/mens-footwear/pr?sid=osp,cil

## `maxItemsPerStartUrl` (type: `integer`):

Maximum number of products to scrape for each URL. This is a hard cap on the total returned — set it high to get ALL products. The scraper paginates through every result page automatically and stops at this limit. Default 500.

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

Flipkart blocks datacenter IPs. Apify Residential proxies (country India) are strongly recommended and used by default.

## Actor input object example

```json
{
  "searchUrls": [
    {
      "url": "https://www.flipkart.com/search?q=ghar+soaps"
    }
  ],
  "maxItemsPerStartUrl": 500,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "IN"
  }
}
```

# Actor output Schema

## `products` (type: `string`):

Structured Flipkart product records with price, MRP, rating, reviews, and image.

# 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 = {
    "searchUrls": [
        {
            "url": "https://www.flipkart.com/search?q=ghar+soaps"
        }
    ],
    "maxItemsPerStartUrl": 500,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "IN"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("patel_dev_automation/flipkart-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 = {
    "searchUrls": [{ "url": "https://www.flipkart.com/search?q=ghar+soaps" }],
    "maxItemsPerStartUrl": 500,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "IN",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("patel_dev_automation/flipkart-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 '{
  "searchUrls": [
    {
      "url": "https://www.flipkart.com/search?q=ghar+soaps"
    }
  ],
  "maxItemsPerStartUrl": 500,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "IN"
  }
}' |
apify call patel_dev_automation/flipkart-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/EG6DZwX1XiyLoSZ91/builds/2WxSBqs5o78tiva55/openapi.json
