# Divar Scraper - Iran Classified Ads, Prices & Cities (`logiover/divar-scraper`) Actor

Export Divar.ir classified ads in bulk from any Iranian city or category: title, price in toman, condition, city and district, photo count and ad URL. Search by keyword or walk a whole category. Download as JSON, CSV or Excel.

- **URL**: https://apify.com/logiover/divar-scraper.md
- **Developed by:** [Logiover](https://apify.com/logiover) (community)
- **Categories:** E-commerce, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.10 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#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

## Divar Scraper — Iran Classified Ads, Prices & Cities

Divar.ir in rows: ad title, price in toman as a real number, condition, city and district, photo count and a direct ad link — from any Iranian city or category.

### What does the Divar Scraper do?

This Actor collects classified ads from **Divar**, by far the largest marketplace in Iran and the place almost every private sale in the country goes through. It returns one row per ad with the **price converted from Persian numerals into a number you can sort on**, alongside the original text exactly as the site printed it.

That conversion is the point. Divar publishes prices as "۸۵٬۰۰۰٬۰۰۰ تومان" — Persian-Indic digits that no spreadsheet will treat as a figure. The Actor transliterates them and keeps both forms, so you can filter on price and still check any row against the site by eye.

The other thing it handles for you is paging. Divar's gateway does not accept a page number past the first request: it hands back a cursor carrying the last ad's timestamp and the tokens already served, and expects that object back verbatim. Send a page number instead and you get the opening block over and over — which is why a naive crawl of Divar quietly returns the same twenty-four ads forever.

### Who is it for?

- **Market researchers** studying Iranian consumer prices and supply.
- **Pricing analysts** tracking second-hand values across cities.
- **Automotive and property analysts** measuring listing volumes and asking prices.
- **Economists and journalists** using classified prices as an inflation signal.
- **Trade and sourcing teams** mapping what is available in the Iranian market.
- **Academics** studying informal and second-hand economies at scale.

### Use cases

- Track asking prices for a product category across Tehran over time.
- Compare prices for the same category between several cities.
- Measure listing volume in a category as a demand indicator.
- Build a second-hand price index from real classified data.
- Watch new-versus-used supply using the condition column.
- Collect ads with photos for a visual catalogue.
- Study how prices move in a high-inflation market month to month.

### Why use this Divar Scraper?

- **Cursor pagination handled properly**, which is the difference between thousands of ads and the same first page repeated.
- **Persian numerals converted to real numbers**, with the original text kept alongside.
- **City and district on every row**, so you can compare neighbourhoods, not just cities.
- **Keyword, category and multi-city crawling** in a single run.
- **Iran-pinned residential proxying**, because Divar answers requests from inside the country.
- **Condition and promotion flags**, so paid-bump listings can be separated from ordinary ones.

### What data can you extract?

| Field | Description |
| --- | --- |
| `token` | Divar's own ad token, stable per listing |
| `title` | Ad title |
| `price` | Price in toman as a number |
| `priceText` | Price exactly as Divar printed it |
| `condition` | New, used or the seller's own wording |
| `city` | City in Persian |
| `district` | Neighbourhood in Persian |
| `imageCount` | How many photos the ad carries |
| `isPromoted` | Whether the seller paid to bump the ad |
| `imageUrl` | First photo |
| `url` | Direct link to the ad |

#### Sample output

```json
{
  "token": "galV9lwr",
  "title": "آیفون ۱۶ قسطی با شرایط ویژه بدون ضامن",
  "price": 85000000,
  "priceText": "۸۵,۰۰۰,۰۰۰ تومان",
  "condition": "نو",
  "city": "تهران",
  "district": "گیشا",
  "imageCount": 5,
  "isPromoted": true,
  "imageUrl": "https://s100.divarcdn.com/static/photo/neda/webp_thumbnail/k.webp",
  "url": "https://divar.ir/v/galV9lwr"
}
```

### How to use the Divar Scraper

#### Option A — one city, one category

Leave **City IDs** as `1` (Tehran), set **Category slug** to something like `mobile-phones`, set **Maximum ads** and run.

#### Option B — several cities at once

Add more IDs to **City IDs**, one per line. All of them are crawled into the same dataset.

#### Option C — keyword search

Put a term into **Search terms**. Persian works best, but Latin brand and model names appear in many titles too.

#### Option D — a whole city

Leave both the category and the search empty. The crawl then walks everything currently listed in the chosen cities.

### Input parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `cityIds` | array | Divar city IDs, one per line; Tehran is 1 |
| `category` | string | Category slug from a Divar category URL |
| `searchQueries` | array | Free-text search terms |
| `maxItems` | integer | How many ads to collect in total |
| `proxyConfiguration` | object | Iran-pinned residential proxy, required |

### Tips for best results

- **Leave the proxy pinned to Iran.** Divar does not serve its listing gateway to requests from outside the country.
- **Use `price`, not `priceText`, for anything numeric.** The text form is there so you can verify a row, not so you can compute with it.
- **Category slugs come from the URL.** Open the category on Divar and copy the last path segment.
- **Ads marked `isPromoted` are paid bumps.** Filter them out when you want an unbiased view of supply.
- **Free items and "price on request" ads have no price**, so a small share of rows carry text but no number.

### Integrations

Send results to Google Sheets, Airtable, Slack, Zapier, Make or your own service through Apify's integrations, or schedule a run to track a category over time.

### API usage

```bash
curl -X POST "https://api.apify.com/v2/acts/YOUR_USERNAME~divar-scraper/runs?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "cityIds": ["1"],
    "category": "mobile-phones",
    "maxItems": 1000
  }'
```

Results export as JSON, CSV, Excel, XML or RSS.

### Use with AI agents (MCP)

Available as a tool through Apify's MCP server, so an agent can look up Iranian market prices or summarise what is listed in a category.

### FAQ

#### Do I need a Divar account or API key?

No. The listing gateway this Actor reads is the same one the Divar website calls.

#### How many ads can one run return?

Divar's cursor pages a long way back, so several thousand ads from a busy category is routine.

#### Where do I find a city ID?

Tehran is `1`. Other cities have their own numeric IDs, visible in the requests Divar's own site makes when you switch city.

#### Why is the price sometimes empty?

Because the ad has no price — free items, swaps and "call for price" listings are common on Divar. The text column shows whatever the seller wrote.

#### What does `isPromoted` mean?

The seller paid to bump the ad back to the top. It is worth filtering out when you are measuring genuine supply.

#### Are titles and cities in Persian?

Yes. Divar is a Persian-language site and the Actor reports its text as written rather than machine-translating it.

#### Can I search in English?

Partly. Latin brand and model names do appear in Divar titles, but Persian terms return far more.

#### Can I export to CSV or Excel?

Yes — JSON, CSV, Excel, XML and RSS.

#### How fresh is the data?

Every run reads Divar live.

#### Why did my run return zero ads?

Usually a category slug that does not exist. Open the category on divar.ir and copy the slug from its URL.

### Is it legal to scrape Divar?

This Actor reads publicly listed ads, which is generally lawful to collect. You are responsible for how you use the data — check Divar's terms, treat any seller detail as personal data under applicable privacy law, and do not use it for unsolicited bulk contact.

### Related scrapers

Pair with the other classifieds Actors in the store to cover the Middle East, South Asia and Europe alongside Iran.

***

\*Maintained: last verified 2026-09-01 — checked end-to-end against live run history (reliability, output fields and types, and time/memory budgets).

# Actor input Schema

## `cityIds` (type: `array`):

Divar city IDs to crawl, one per line. Tehran is 1. Several cities can be crawled together.

## `category` (type: `string`):

Optional. Restrict to one Divar category, taken from the category page URL - for example mobile-phones, cars, home-kitchen.

## `searchQueries` (type: `array`):

Optional. Free-text search inside the chosen cities and category. Persian terms work best.

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

How many ads to collect in total.

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

Required. Divar answers requests from inside Iran, so the run is pinned to Iranian residential addresses.

## Actor input object example

```json
{
  "cityIds": [
    "1"
  ],
  "category": "mobile-phones",
  "maxItems": 500,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "IR"
  }
}
```

# Actor output Schema

## `results` (type: `string`):

Every record collected in this run. Open the Dataset tab to browse, filter or export as JSON, CSV or Excel.

# 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 = {
    "cityIds": [
        "1"
    ],
    "category": "mobile-phones",
    "maxItems": 500,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "IR"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("logiover/divar-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 = {
    "cityIds": ["1"],
    "category": "mobile-phones",
    "maxItems": 500,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "IR",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("logiover/divar-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 '{
  "cityIds": [
    "1"
  ],
  "category": "mobile-phones",
  "maxItems": 500,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "IR"
  }
}' |
apify call logiover/divar-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,logiover/divar-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/PFbGAYvZ5bxYtBcJi/builds/L7qE05gwcWrh0S9Ut/openapi.json
