# (Working!) DHgate Listings Scraper (`architjn/dhgate-listings-scraper`) Actor

Scrape product listing cards from DHgate category and search pages. Export titles, prices, item codes, store names, images, and promo badges - paginate up to 50 pages per URL with residential proxy support.

- **URL**: https://apify.com/architjn/dhgate-listings-scraper.md
- **Developed by:** [Archit Jain](https://apify.com/architjn) (community)
- **Categories:** E-commerce, Other
- **Stats:** 2 total users, 1 monthly users, 66.7% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

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

## DHgate Listings Scraper

Collect product listing cards from [DHgate](https://www.dhgate.com) category and wholesale search pages. Each row includes the product title, price, item code, image, store name, shipping and promo badges, and links to the product and seller — with pagination up to **50 pages per URL**.

Paste the listing URL from your browser after applying any filters or sort order on the site. The actor does **not** open individual product detail pages.

### Input

Configure these fields in the Apify Console **Input** tab before you click **Start**.

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| **Listing URLs** | list of URLs | Yes | Dog apparel sample | One or more DHgate listing page URLs (`/wholesale/.../c….html` or search listing URLs with the same pattern). |
| **Max pages per URL** | number | Yes | `1` | How many listing pages to fetch per URL (1–50). Stops early for that URL if a page returns no products. |
| **Proxy configuration** | proxy | No | Residential on | Apify residential proxy (recommended). Enabled by default on Apify cloud. |

#### Tips

- Use the URL from the address bar after you set **Ship to**, sort, and filters on DHgate.
- Tracking parameters (`dspm`, `resource_id`, hash fragments) are stripped automatically; essential filters like `leftpars` are kept when present.
- Page 2 uses DHgate’s `c{id}-1.html` URL pattern; the actor builds these URLs for you.

### Output

Results appear in the run **Dataset** tab — one row per product card on the listing grid.

| Field | What you get |
|-------|----------------|
| `rank` | Position on that page (1 = first) |
| `pageNumber` | Listing page number for this URL |
| `pageUrl` | URL that was fetched |
| `sourceListingUrl` | Your normalized input URL |
| `title` | Product title |
| `productUrl` | Link to the product page |
| `itemCode` | DHgate item code (numeric id) |
| `productId` | Internal product id from listing markup |
| `imageUrl` | Thumbnail image |
| `priceText` | Price as shown (e.g. `US $6.76 - 10.97 / Piece`) |
| `soldText` | Sold count when shown (e.g. `12 Sold`) |
| `freeShipping` | Whether “Free shipping” appears on the card |
| `promoBadges` | Coupon / discount labels |
| `minOrderText` | Minimum order text when shown |
| `storeName`, `storeUrl` | Seller store |
| `categoryBreadcrumb` | Category path from the page |
| `totalResultsText` | Total results text (e.g. `(10,929 results)`) |
| `scrapedAt` | When the row was collected (ISO time) |

Download as **JSON**, **CSV**, or **Excel** from the dataset, or use the Apify API and integrations.

### Pricing Structure

**Pay per usage** — you pay for compute units (CPU, memory, runtime) consumed during the run. Platform usage depends on your Apify plan. Set a **spending limit** before large jobs.

### Examples

#### Single category, first page

| Field | Value |
|-------|--------|
| Listing URLs | `https://www.dhgate.com/wholesale/dog-apparel/c210004027.html` |
| Max pages per URL | `1` |

**Sample output (one row):**

```json
{
  "rank": 1,
  "pageNumber": 1,
  "title": "Designer Dog Clothes Luxury Plaid Collar Dog Shirt",
  "priceText": "US $6.76 - 10.97 / Piece",
  "itemCode": "1105058624",
  "storeName": "dggestore",
  "freeShipping": true,
  "productUrl": "https://www.dhgate.com/product/..."
}
````

#### Three pages of the same category

| Field | Value |
|-------|--------|
| Listing URLs | `https://www.dhgate.com/wholesale/dog-apparel/c210004027.html` |
| Max pages per URL | `3` |

Expect roughly 30–35 listings per page (~100 rows total if all pages load successfully).

#### Multiple categories in one run

| Field | Value |
|-------|--------|
| Listing URLs | `https://www.dhgate.com/wholesale/dog-shirts/c210004027009.html`, `https://www.dhgate.com/wholesale/dog-dresses/c210004027007.html` |
| Max pages per URL | `2` |

Each URL is scraped independently; duplicate `itemCode` values across URLs are kept (with different `sourceListingUrl`).

### Best Practices

1. **Start with `maxPages: 1`** to confirm URLs and proxy settings before scaling up.
2. **Keep residential proxy enabled** on Apify cloud — bare datacenter requests are often blocked by Akamai.
3. **Apply filters on the website first**, then copy the listing URL; the actor does not change sort or ship-to for you.
4. **Watch for empty pages** — pagination stops for that URL when a page returns zero products (end of catalog or access issue).
5. **Set a spending limit** on long runs (many URLs × many pages).

# Actor input Schema

## `listingUrls` (type: `array`):

One or more DHgate listing page URLs (category or search results). Example: https://www.dhgate.com/wholesale/pet-supplies/c210.html

## `maxPages` (type: `integer`):

How many listing pages to fetch for each URL (page 1, then 2, 3, …). Stops early if a page returns no products.

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

Apify residential proxy (enabled by default on cloud). Required for reliable access to DHgate from datacenter IPs.

## Actor input object example

```json
{
  "listingUrls": [
    "https://www.dhgate.com/wholesale/pet-supplies/c210.html"
  ],
  "maxPages": 1,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `listings` (type: `string`):

Scraped product cards with price, store, and links.

## `dataset` (type: `string`):

All listing records from this run in JSON format.

## `runInput` (type: `string`):

Copy of the Actor input used for this run.

# 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 = {
    "listingUrls": [
        "https://www.dhgate.com/wholesale/pet-supplies/c210.html"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("architjn/dhgate-listings-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 = {
    "listingUrls": ["https://www.dhgate.com/wholesale/pet-supplies/c210.html"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("architjn/dhgate-listings-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 '{
  "listingUrls": [
    "https://www.dhgate.com/wholesale/pet-supplies/c210.html"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call architjn/dhgate-listings-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "(Working!) DHgate Listings Scraper",
        "description": "Scrape product listing cards from DHgate category and search pages. Export titles, prices, item codes, store names, images, and promo badges - paginate up to 50 pages per URL with residential proxy support.",
        "version": "0.1",
        "x-build-id": "ofuFSAea6Kx92lgWh"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/architjn~dhgate-listings-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-architjn-dhgate-listings-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/architjn~dhgate-listings-scraper/runs": {
            "post": {
                "operationId": "runs-sync-architjn-dhgate-listings-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/architjn~dhgate-listings-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-architjn-dhgate-listings-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": [
                    "listingUrls",
                    "maxPages"
                ],
                "properties": {
                    "listingUrls": {
                        "title": "Listing URLs",
                        "minItems": 1,
                        "type": "array",
                        "description": "One or more DHgate listing page URLs (category or search results). Example: https://www.dhgate.com/wholesale/pet-supplies/c210.html",
                        "default": [
                            "https://www.dhgate.com/wholesale/pet-supplies/c210.html"
                        ],
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxPages": {
                        "title": "Max pages per URL",
                        "minimum": 1,
                        "maximum": 50,
                        "type": "integer",
                        "description": "How many listing pages to fetch for each URL (page 1, then 2, 3, …). Stops early if a page returns no products.",
                        "default": 1
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Apify residential proxy (enabled by default on cloud). Required for reliable access to DHgate from datacenter IPs."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
