# Avito Morocco Classifieds Scraper (`scraper_guru/avito-maroc-scraper`) Actor

Scrape Avito.ma listings across Morocco. Extract titles, prices, locations, attributes, descriptions, and images for real estate, vehicle, and market research.

- **URL**: https://apify.com/scraper_guru/avito-maroc-scraper.md
- **Developed by:** [LIAICHI MUSTAPHA](https://apify.com/scraper_guru) (community)
- **Categories:** E-commerce, Lead generation, Real estate
- **Features:** Limited permissions
- **Stats:** 33 total users, 4 monthly users, 99.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

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

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Avito Morocco Classifieds Scraper

Scrape structured listings from **Avito.ma**, including titles, prices, locations, category attributes, descriptions, images, and source URLs. Use the data for Moroccan real estate, vehicle, classifieds, and pricing research.

### Features

- Extracts listing details from Avito's embedded page data
- Supports category pages, search pages, and individual listing URLs
- Preserves category-specific attributes such as brand, model, mileage, rooms, or surface
- Collects city, area, description, images, price, and currency
- Enforces a configurable result limit before broad searches queue too many pages
- Exports structured data through the Apify dataset API in JSON, CSV, Excel, and other formats

### Use Cases

- **Price monitoring:** compare used vehicle, property, or product prices over time
- **Market research:** measure inventory and price differences across Moroccan cities
- **Competitive intelligence:** monitor category supply and listing changes
- **Data pipelines:** feed structured Avito listings into BI, RAG, or analytics workflows
- **Lead research:** identify active listings and their publicly available details

### Input

| Field | Type | Default | Description |
|---|---|---:|---|
| `startUrls` | array | Avito vehicle search | Search, category, or individual listing URLs |
| `maxItems` | integer | `100` | Maximum records to save; `0` means unlimited |
| `maxConcurrency` | integer | `10` | Maximum pages fetched in parallel |
| `proxyConfiguration` | object | Residential Proxy | Residential proxy configuration used to avoid Avito blocks |

```json
{
  "startUrls": [
    { "url": "https://www.avito.ma/fr/maroc/voitures-a_vendre" }
  ],
  "maxItems": 100,
  "maxConcurrency": 10,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"]
  }
}
```

### Output

Each dataset item represents one Avito listing:

```json
{
  "url": "https://www.avito.ma/fr/casablanca/voitures/example_123456.htm",
  "id": 123456,
  "title": "Peugeot 208 Diesel 2019",
  "price": 115000,
  "currency": "DH",
  "location": {
    "city": "Casablanca",
    "area": "Maarif"
  },
  "attributes": {
    "Marque": "Peugeot",
    "Modele": "208",
    "Annee-Modele": "2019"
  },
  "description": "Public listing description...",
  "images": ["https://content.avito.ma/classifieds/images/example"],
  "scrapedAt": "2026-07-11T10:00:00.000Z"
}
```

The `STATS` key-value store record contains the number of listings saved and the limits used for the run.

### How to Use

1. Open the Actor and click **Try for free**.
2. Add one or more Avito category, search, or listing URLs.
3. Start with `maxItems: 10` to verify the target category.
4. Enable a suitable proxy for larger recurring runs.
5. Start the run and open the **Output** tab.
6. Download the dataset or access it through the Apify API.

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

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('scraper_guru/avito-maroc-scraper').call({
  startUrls: [{ url: 'https://www.avito.ma/fr/maroc/voitures-a_vendre' }],
  maxItems: 100,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

### Pricing

This is a pay-per-event Actor. A successfully saved listing costs **$0.005**, or **$5 per 1,000 results**, plus any platform usage shown by Apify. Start with a small limit to estimate total cost for your target category.

### FAQ

**Which Avito categories are supported?**\
Any category that uses the standard Avito.ma listing structure, including vehicles, real estate, electronics, and other classifieds.

**Why did a run return fewer items than requested?**\
The search may contain fewer matching listings, a page may have changed structure, or Avito may have limited requests. Try a smaller concurrency and an appropriate proxy.

**Does the Actor extract private seller contact data?**\
No. It extracts fields publicly available in the listing page data.

**Can I run it on a schedule?**\
Yes. Create an Apify Task and schedule it to produce repeatable market snapshots.

**Is scraping Avito legal?**\
Use the Actor only for lawful purposes. Follow Avito's terms, applicable data-protection rules, and reasonable request limits.

For bugs or target-site changes, open the **Issues** tab on this Actor.

# Actor input Schema

## `startUrls` (type: `array`):

Avito.ma category, search-result, or individual listing URLs to scrape.

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

Maximum number of listing records to save. Set to 0 for unlimited.

## `maxConcurrency` (type: `integer`):

Maximum pages fetched in parallel. Reduce this value if Avito starts limiting requests.

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

Optional proxy settings for larger or frequently repeated runs.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.avito.ma/fr/maroc/voitures-a_vendre"
    }
  ],
  "maxItems": 10,
  "maxConcurrency": 5,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

No description

## `runStats` (type: `string`):

No description

# 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 = {
    "startUrls": [
        {
            "url": "https://www.avito.ma/fr/maroc/voitures-a_vendre"
        }
    ],
    "maxItems": 10,
    "maxConcurrency": 5,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("scraper_guru/avito-maroc-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 = {
    "startUrls": [{ "url": "https://www.avito.ma/fr/maroc/voitures-a_vendre" }],
    "maxItems": 10,
    "maxConcurrency": 5,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("scraper_guru/avito-maroc-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 '{
  "startUrls": [
    {
      "url": "https://www.avito.ma/fr/maroc/voitures-a_vendre"
    }
  ],
  "maxItems": 10,
  "maxConcurrency": 5,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call scraper_guru/avito-maroc-scraper --silent --output-dataset

```

## MCP server setup

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