# Divar Scraper — Iran Classifieds Ads, Cars & Real Estate (`hipersoft/divar-scraper`) Actor

Scrape classified ads from Divar, Iran's largest marketplace: title, price (Toman), category, city, district, images and the listing URL. Search any Iranian city with an optional keyword and export one clean row per ad as JSON, CSV or Excel. For market research, price tracking and n8n.

- **URL**: https://apify.com/hipersoft/divar-scraper.md
- **Developed by:** [hiper soft](https://apify.com/hipersoft) (community)
- **Categories:** E-commerce, Real estate
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.0015 / listing scraped

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 Classifieds Listings (Cars, Real Estate, Goods & Jobs)

Scrape classified ads from **Divar**, Iran's largest online marketplace, into clean, structured **JSON, CSV or Excel**. Search any Iranian **city** with an optional **keyword** or **category** and pull every listing — **title, price in Toman, category, city, district, images and the ad URL** — one tidy row per ad. Built for price tracking, market research, competitive analysis and automations.

### Features

- 🚗 **Every category** — cars, real estate, mobile phones, home goods, jobs, services and more, all from one Actor.
- 🏙️ **Search any city** — Tehran, Mashhad, Isfahan, Shiraz, Tabriz, Karaj and dozens more, by English name, Persian name or city id.
- 🔎 **Keyword filter** — narrow to exactly what you want (e.g. `پراید`, `آپارتمان`, `iphone`).
- 💰 **Prices in Toman** — the numeric price is parsed for you, plus the original price text.
- 🧭 **Location detail** — city and district for every ad, ready for geo analysis.
- 🖼️ **Images** — thumbnail image URL and image count per listing.
- 🔗 **Direct ad URL** — a ready-to-open link to each listing on Divar.
- 📄 **Volume control** — set `maxItems` to balance coverage and cost.

### Input

```json
{
  "city": "tehran",
  "query": "پراید",
  "category": "cars",
  "maxItems": 100
}
```

| Field | Description |
| --- | --- |
| `city` | Iranian city to search — English name/slug (`tehran`, `mashhad`, `shiraz`…), Persian name (`تهران`) or a numeric city id. Defaults to Tehran. |
| `query` | Optional keyword to filter ads (e.g. `پراید`, `آپارتمان`, `iphone`). Leave empty for all recent ads. |
| `category` | Optional Divar category slug to narrow the search (e.g. `cars`, `real-estate`, `mobile-phones`). |
| `maxItems` | Maximum ads to collect (0 = no limit). |

#### How to search

Enter a `city` and run to collect the latest ads. Add a `query` to filter by keyword, or a `category` slug to focus on one section of the marketplace. Set `maxItems` to control how much you collect.

### Use cases

- Track prices for cars, phones or property across Iranian cities over time.
- Build and refresh a classifieds dataset for market and demand analysis.
- Monitor new listings for specific keywords in target cities.
- Generate lead lists of sellers by category and location.
- Feed structured ad records into a CRM, spreadsheet or analytics pipeline.

### What you get

Each ad is one dataset record:

```json
{
  "token": "QaXuuOxt",
  "title": "پراید ۱۴۱ dlxi",
  "price": 380000000,
  "priceText": "۳۸۰,۰۰۰,۰۰۰ تومان",
  "currency": "IRT",
  "category": "cars",
  "city": "تهران",
  "district": "خزانه",
  "subtitle": "دقایقی پیش در خزانه",
  "condition": null,
  "tags": null,
  "thumbnailUrl": "https://s100.divarcdn.com/static/photo/.../thumbnail.webp",
  "images": ["https://s100.divarcdn.com/static/photo/.../thumbnail.webp"],
  "imageCount": 6,
  "url": "https://divar.ir/v/پراید-۱۴۱-dlxi/QaXuuOxt",
  "adInstanceId": "…_QaXuuOxt_P"
}
```

#### Output schema

| Field | Type | Description |
|---|---|---|
| `token` | string | Divar's unique identifier for the ad. |
| `title` | string | Ad title. |
| `price` | integer | Price in Toman (numeric). `null` when the ad has no fixed price (e.g. negotiable, free, or deposit/rent). |
| `priceText` | string | Price exactly as displayed on Divar. |
| `currency` | string | Currency code (`IRT`, Iranian Toman). |
| `category` | string | Category, when a category filter is used. |
| `city` | string | City the ad is posted in. |
| `district` | string | District / neighbourhood. |
| `subtitle` | string | Secondary line shown under the ad (often relative time + district). |
| `condition` | string | Item condition where shown (e.g. new / used). |
| `tags` | string | Extra highlight tags where shown. |
| `thumbnailUrl` | string (URL) | Thumbnail image URL. |
| `images` | array | Image URLs available for the ad. |
| `imageCount` | integer | Number of photos on the ad. |
| `url` | string (URL) | Direct link to the ad on Divar. |
| `adInstanceId` | string | Divar's per-impression ad instance id. |

### Related Actors

- [Vinted Scraper](https://apify.com/hipersoft/vinted-scraper)
- [OLX Scraper](https://apify.com/hipersoft/olx-scraper)
- [Amazon Product Scraper](https://apify.com/hipersoft/amazon-product-scraper)
- [Google Maps Scraper](https://apify.com/hipersoft/google-maps-scraper)

### FAQ

**Do I need a Divar account?**
No. Just enter a city and run.

**Which cities are supported?**
Any Iranian city on Divar — enter its English name/slug, Persian name, or numeric city id. Major metros (Tehran, Mashhad, Isfahan, Shiraz, Tabriz, Karaj and many more) are recognised by name.

**In what currency are prices?**
Prices are in Iranian Toman (`IRT`). The numeric `price` is parsed for you; `priceText` keeps the original as displayed.

**How many ads can I collect?**
As many as your search returns. Use `maxItems` to control volume and cost.

**What export formats are supported?**
JSON, CSV, Excel and XML, plus the Apify API for programmatic access.

**Can I use this with n8n?**
Yes. Use the [Apify node for n8n](https://docs.apify.com/platform/integrations/n8n) to run this Actor and pull its dataset straight into an n8n workflow — trigger it on a schedule, then route the ad rows to a database, spreadsheet or messaging step.

**Can I connect it to other tools?**
The Divar Scraper connects with almost any cloud service or web app thanks to [integrations on the Apify platform](https://apify.com/integrations). It works with [Make](https://apify.com/integrations/make), [Zapier](https://apify.com/integrations/zapier), [Slack](https://docs.apify.com/platform/integrations/slack), [Airbyte](https://docs.apify.com/platform/integrations/airbyte), [GitHub](https://docs.apify.com/platform/integrations/github), [Google Drive](https://docs.apify.com/platform/integrations/drive) and [many more](https://apify.com/integrations), plus the [Apify API](https://docs.apify.com/api/v2), JavaScript/Python clients and MCP. Or use [webhooks](https://docs.apify.com/platform/integrations/webhooks) to trigger an action whenever a run finishes.

### Notes

Returns only public Divar ad data — the same information any visitor can see. This is an independent tool and is not affiliated with, endorsed by or connected to Divar; "Divar" is a trademark of its respective owner. Original clean-room implementation.

# Actor input Schema

## `city` (type: `string`):

Iranian city to search. Use an English name/slug (e.g. tehran, mashhad, isfahan, shiraz, tabriz, karaj), the Persian name (e.g. تهران), or a Divar numeric city id. Defaults to Tehran.

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

Optional free-text keyword to filter ads, e.g. پراید (Pride car), آپارتمان (apartment) or iphone. Leave empty to collect all recent ads in the city.

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

Optional Divar category slug to narrow the search, e.g. cars, real-estate, mobile-phones, home-kitchen. Leave empty to search across all categories.

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

Maximum number of ads to collect (0 = no limit; collect everything the search returns).

## Actor input object example

```json
{
  "city": "tehran",
  "maxItems": 100
}
```

# Actor output Schema

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

The results as dataset items.

# 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 = {
    "city": "tehran"
};

// Run the Actor and wait for it to finish
const run = await client.actor("hipersoft/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 = { "city": "tehran" }

# Run the Actor and wait for it to finish
run = client.actor("hipersoft/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 '{
  "city": "tehran"
}' |
apify call hipersoft/divar-scraper --silent --output-dataset

```

## MCP server setup

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