# Daraz (`rigelbytes/daraz`) Actor

Scrape product listings from Daraz.pk with the custom query, optional proxy, and pagination for e-commerce insights.

- **URL**: https://apify.com/rigelbytes/daraz.md
- **Developed by:** [Rigel Bytes](https://apify.com/rigelbytes) (community)
- **Categories:** E-commerce
- **Stats:** 121 total users, 2 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$2.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period. You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#rental-actors

## 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

## Daraz.pk Scraper by Rigel Bytes

### About the Scraper

The **Daraz.pk Scraper** allows you to extract product listings and detailed information from **Daraz**, the largest e-commerce platform in Pakistan. Whether you're performing price comparisons, competitor analysis, or market research, this scraper will efficiently collect data like product details, prices, seller information, and more.

### Key Features

- Extracts product details including **name**, **price**, **rating**, **reviews**, and **availability**.
- Fetches **seller information** like seller name and location.
- Optionally input a **proxy** for private and controlled scraping.
- Scrape multiple pages of results by specifying the number of pages to extract.
- Supports both **JSON** and **CSV** output formats.

### Use Cases

- Price Monitoring: Track price changes across products.
- Competitor Analysis: Gather insights about sellers, product availability, and ratings.
- Market Research: Analyze trends across different product categories.

### Input Parameters

- **query (required)**: The search query (e.g., "laptop", "phone", "shoes").
- **pages (optional)**: The number of pages to scrape (default: 1).
- **proxy (optional)**: Your own proxy to use during scraping (useful for large-scale scraping).

### Recommended Proxy Providers

- ## **Shifter**

  - Reliable residential proxies all over the world.
  - Cheap rates
  - [Order Shifter Now](https://shifter.io/r/YoBB/order)
  - Get 10% Off any product, use coupan `rigelbytes-YoBB`.

- ## **OxyLabs**
  - **100M+ Proxies**
  - Fastest proxies in the market
  - Real profile, human-like Residential IPs
  - Quality assurance framework for most reliable IPs
  - [Get Proxies](https://oxylabs.go2cloud.org/aff_c?offer_id=7\&aff_id=1366\&url_id=7)

### [![Learn More About Proxies](https://img.shields.io/badge/Learn_More-About_Proxies-blue?style=for-the-badge)](#understanding-proxies)

### 🙌 Why Buy Through Our Affiliate Link?

- Exclusive Deals: Some providers may offer special discounts or bonuses when you use our link.
- Support Our Work: Each purchase helps us maintain and improve the tools and services we provide.
- No Extra Cost: You pay the same price, but part of it goes to supporting our efforts.

### API Request Examples

#### Python

```shell
from apify_client import ApifyClient

## Initialize the ApifyClient with your API token
client = ApifyClient("<YOUR_API_TOKEN>")

## Prepare the Actor input
run_input = {
  "query": "mouthwash",
  "pages": 3,
  "proxy": "http://username:password@proxyaddress:port"
}

## Run the Actor and wait for it to finish
run = client.actor("rigelbytes/daraz").call(run_input=run_input)

## Fetch and print Actor results from the run's dataset (if there are any)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

#### Node.js

```shell
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with API token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
  "query": "mouthwash",
  "pages": 3,
  "proxy": "http://username:password@proxyaddress:port"
};

(async () => {
    // Run the Actor and wait for it to finish
    const run = await client.actor("rigelbytes/daraz").call(input);

    // Fetch and print Actor results from the run's dataset (if any)
    console.log('Results from dataset');
    const { items } = await client.dataset(run.defaultDatasetId).listItems();
    items.forEach((item) => {
        console.dir(item);
    });
})();
```

### cURL

```shell
## Set API token
API_TOKEN=<YOUR_API_TOKEN>

## Prepare Actor input
cat > input.json <<'EOF'
{
  "query": "mouthwash",
  "pages": 3,
  "proxy": "http://username:password@proxyaddress:port"
}
EOF

## Run the Actor
curl "https://api.apify.com/v2/acts/rigelbytes/daraz/runs?token=$API_TOKEN" \
  -X POST \
  -d @input.json \
  -H 'Content-Type: application/json'

```

### Output

![Output Image](https://github.com/faizanalii/apify-images/blob/main/output.png?raw=true)

```json
{
  "name": {
    "format": "string",
    "label": "Name"
  },
  "itemUrl": {
    "format": "link",
    "label": "URL"
  },
  "image": {
    "format": "image",
    "label": "Primary Image"
  },
  "price": {
    "format": "string",
    "label": "Price"
  },
  "originalPriceShow": {
    "format": "string",
    "label": "Original Price Show"
  },
  "priceShow": {
    "format": "string",
    "label": "Price (Unformatted)"
  },
  "ratingScore": {
    "format": "string",
    "label": "Rating"
  },
  "review": {
    "format": "string",
    "label": "Reviews"
  },
  "nid": {
    "format": "string",
    "label": "Nid"
  },
  "itemId": {
    "format": "link",
    "label": "Item ID"
  },
  "isSmartImage": {
    "format": "boolean",
    "label": "Is Smart Image"
  },
  "location": {
    "format": "string",
    "label": "Location"
  },
  "sellerName": {
    "format": "string",
    "label": "Seller Name"
  },
  "sellerId": {
    "format": "string",
    "label": "Seller ID"
  },
  "brandName": {
    "format": "string",
    "label": "Brand Name"
  },
  "brandId": {
    "format": "string",
    "label": "Brand ID"
  },
  "cheapest_sku": {
    "format": "string",
    "label": "Cheapest SKU"
  },
  "skuId": {
    "format": "string",
    "label": "SKU ID"
  },
  "sku": {
    "format": "string",
    "label": "SKU"
  },
  "showFeedBack": {
    "format": "boolean",
    "label": "Show Feedback"
  },
  "inStock": {
    "format": "boolean",
    "label": "In Stock"
  },
  "itemSoldCntShow": {
    "format": "string",
    "label": "Items Sold"
  },
  "longImageDisplayable": {
    "format": "boolean",
    "label": "Long Image Displayable"
  },
  "promotionId": {
    "format": "boolean",
    "label": "Promotion ID"
  },
  "isSponsored": {
    "format": "boolean",
    "label": "Is Sponsored"
  },
  "tItemType": {
    "format": "string",
    "label": "Item Type"
  },
  "skuType": {
    "format": "string",
    "label": "SKU Type"
  },
  "adFlag": {
    "format": "string",
    "label": "Ad Flag"
  },
  "directSimilarUrl": {
    "format": "string",
    "label": "Direct Similar URL"
  },
  "gridTitleLine": {
    "format": "string",
    "label": "Grid Title Line"
  },
  "isFission": {
    "format": "string",
    "label": "Is Fission"
  },
  "isBadgeAutoScroll": {
    "format": "boolean",
    "label": "Is Badge Auto Scroll"
  },
  "showCart": {
    "format": "boolean",
    "label": "Show Cart"
  }
}
```

### Requirements

- An Apify account
- Search Query.

### Understanding Proxies:

When scraping data or browsing anonymously, proxies are essential. They act as intermediaries, masking your original IP address and allowing you to send requests from another location.

#### Why Use Proxies?

- Avoid IP Blocks: By routing requests through proxies, you prevent the target website from recognizing your IP as a scraper or spammer.
- Access Geo-restricted Content: Proxies let you access content or websites restricted by location.
- Enhance Anonymity: Hide your actual IP, ensuring privacy while scraping or browsing.

#### Types of Proxies

1. Residential Proxies
   - Real IP addresses provided by ISPs to home users.
   - They mimic regular users, making them harder to detect.
   - Best for: Long-term, undetectable scraping, and avoiding blocks.
2. Data Center Proxies
   - IP addresses from servers in data centers.
   - Faster and cheaper than residential proxies but easier to detect and block.
   - Best for: High-speed scraping, but with a higher risk of detection.
3. Mobile Proxies
   - IPs provided by mobile carriers (3G/4G/5G networks).
   - Very difficult to detect, as they appear as regular mobile users.
   - Best for: Mobile-related scraping or avoiding sophisticated blocks.

#### Rotating Proxies vs. Straight Proxies

- Rotating Proxies: Every request you send goes through a different proxy, making it harder for websites to detect patterns.
- Straight Proxies: All requests are sent through the same proxy, making it easier to track your IP.

### About Rigel Bytes

Rigel Bytes specializes in web scraping, automation, and data analytics. We help businesses extract and leverage valuable data for informed decision-making.

### Contact Us

Ready to unlock the power of data? Reach out to us at (contact@rigelbytes.com) or [book an appointment](https://cal.com/faizanali/appointments) with us to learn more about how we can help you achieve your data goals.

# Actor input Schema

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

Search query to be used.

## `no_of_pages` (type: `integer`):

Number of pages to scrape.

## `proxy` (type: `string`):

Proxy to be used.

## Actor input object example

```json
{
  "query": "mouthwash",
  "no_of_pages": 1,
  "proxy": "https://proxy.crawlera.com:8010/"
}
```

# 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": "mouthwash"
};

// Run the Actor and wait for it to finish
const run = await client.actor("rigelbytes/daraz").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": "mouthwash" }

# Run the Actor and wait for it to finish
run = client.actor("rigelbytes/daraz").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": "mouthwash"
}' |
apify call rigelbytes/daraz --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,rigelbytes/daraz"
        }
    }
}

```

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/LXzORtE7aclEsscWT/builds/eHZZPl0LjDwwd6TZd/openapi.json
