# Avito.ma Morocco Classifieds Search Scraper (`w3crawler/avito-search-results-scraper`) Actor

Extract detailed search results from Avito.ma - Morocco's premier classifieds platform. Supports vehicles, real estate, electronics, and more.

- **URL**: https://apify.com/w3crawler/avito-search-results-scraper.md
- **Developed by:** [w3crawler](https://apify.com/w3crawler) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 1,000 search listings

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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.ma Morocco Classifieds Search Scraper

Collect structured public search results from **Avito.ma**, Morocco's classifieds marketplace. Each row captures the public listing identity, title, price and old price, monthly payment, location and city, category, images, seller details, vehicle parameters, publication flags, and the search context that produced it. The Actor starts with bounded direct HTTPS requests and supports standard Apify Proxy when direct access is blocked; it does not require an account, browser session, CAPTCHA solve, private API, or access-control bypass.

### Get started

1. Open the [Actor Store page](https://apify.com/w3crawler/avito-search-results-scraper) and select **Try for free**, or open the **Input** tab directly.
2. Add public Avito.ma search or listing URLs to `startUrls`. If you omit them, set `query`, `category`, and `city` so the Actor can build a search URL.
3. Keep `maxItems` and `maxPages` small for the first run. Leave `saveDebugHtml` disabled unless you are debugging extraction.
4. Start the Actor, open the dataset, and export the rows as JSON, CSV, or Excel. Open **Run summary** (`OUTPUT`) to check the counts and whether data was available.

### Input

All fields are optional. The table defaults come from `.actor/input_schema.json`; the example JSON reflects the saved Casablanca run.

| Field | Type | Required? | Default | Meaning |
| --- | --- | --- | --- | --- |
| `startUrls` | object array | Optional | Not supplied | Up to 20 public Avito.ma URL objects. When supplied, they take precedence over `query`, `category`, and `city`. |
| `startUrls[].url` | string | Required when a `startUrls` item is supplied | Not supplied | Absolute HTTPS Avito.ma search or listing URL, up to 600 characters. |
| `query` | string | Optional | `voiture` | Keyword query used to build a search URL when `startUrls` is absent, up to 160 characters. |
| `category` | string | Optional | `annonces` | Avito.ma category path used to build a search URL when `startUrls` is absent, up to 100 characters. |
| `city` | string | Optional | `maroc` | Avito.ma location path used to build a search URL when `startUrls` is absent, up to 80 characters. |
| `maxItems` | integer | Optional | `50` | Maximum unique listing rows emitted, from 1 to 500. |
| `maxPages` | integer | Optional | `0` | Maximum public pages requested, from 0 to 20. `0` derives a bounded value from `maxItems`. When `startUrls` are supplied, each URL counts as one page and only the first `maxPages` URLs are requested. |
| `requestTimeoutSecs` | integer | Optional | `30` | Timeout for each public page request, from 5 to 120 seconds. |
| `maxBytes` | integer | Optional | `5000000` | Maximum accepted direct response or local fixture size, from 100,000 to 15,000,000 bytes. |
| `saveDebugHtml` | boolean | Optional | `false` | Debug/QA only: save the first successful public search page HTML to the `debug_html` key-value store record, up to `maxBytes`. Leave disabled for normal collection. |
| `proxyConfiguration` | object | Optional | Not supplied | Optional standard Apify Proxy editor object. Start without proxy and use ordinary proxy transport only when direct public access is blocked. |

Example input from the saved run (`.actor/input.json`):

```json
{
  "startUrls": [
    {
      "url": "https://www.avito.ma/fr/casablanca/voitures"
    }
  ],
  "query": "voiture",
  "category": "voitures",
  "city": "casablanca",
  "maxItems": 10,
  "maxPages": 1,
  "requestTimeoutSecs": 30,
  "maxBytes": 5000000,
  "saveDebugHtml": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

The Actor requests public Avito.ma HTML over HTTPS. When `startUrls` is empty, the search URL is built from `query`, `category`, and `city`. With `maxPages: 0`, the effective page bound is `ceil(maxItems / 30) + 1`, capped at 20. URLs are de-duplicated before use, and source blocking, rate limits, CAPTCHA, login, and other access boundaries are reflected in `OUTPUT` counters and run logs rather than bypassed.

### Output

The dataset contains one row per saved public search result. Values the source does not publish are omitted rather than inferred.

| Field | Type | Availability | Meaning |
| --- | --- | --- | --- |
| `id` | string | Always | Stable listing identifier observed in the source data or derived from the listing URL. |
| `listingId` | string | Always | Avito.ma listing identifier observed or derived from the public URL. |
| `listId` | string | When published | Source list identifier for the classified ad. |
| `title` | string | Always | Listing title reported by Avito.ma. |
| `url` | string | Always | Canonical row URL observed on Avito.ma. |
| `listingUrl` | string | Always | Listing URL observed in the ad link. |
| `position` | integer | When published | One-based position of the result on its source page. |
| `adType` | string | When published | Ad type label shown on the listing. |
| `description` | string | When published | Public listing description. |
| `price` | number | When published | Current public price. |
| `oldPrice` | number | When published | Previous or crossed-out price when the source reports one. |
| `monthlyPayment` | number | When published | Public monthly-payment amount when the listing shows financing. |
| `currency` | string | When published | Currency reported by the source, normally `DH`. |
| `location` | string | When published | Public location label. |
| `city` | string | When published | Public city name. |
| `district` | string | When published | Public district or neighborhood. |
| `category` | string | When published | Public listing category. |
| `categoryId` | string | number | When published | Source identifier for the category, returned as a string or number. |
| `parentCategory` | string | When published | Parent category reported by the source. |
| `imageUrl` | string | When published | Primary public image URL. |
| `imageUrls` | string array | When published | Public image URLs reported for the listing. |
| `videoUrls` | string array | When published | Public video URLs reported for the listing. |
| `sellerName` | string | When published | Public seller or store name. |
| `sellerType` | string | When published | Source seller type, such as `STORE` or `PRIVATE`. |
| `sellerPhone` | string | When published | Seller phone only when the source publishes it. |
| `params` | object | When published | Open object of source parameters; vehicle rows usually contain `regdate`, `mileage_exact`, `bv`, and `fuel`. |
| `publishedAt` | string | When published | Public publication timestamp when the source exposes one. |
| `isPremium` | boolean | When published | Whether the listing is marked premium. |
| `isUrgent` | boolean | When published | Whether the listing is marked urgent. |
| `isHotDeal` | boolean | When published | Whether the listing is marked as a hot deal. |
| `searchQuery` | string | When published | Query recorded for the search that produced the row. |
| `searchUrl` | string | Always | Public search URL used for the run. |
| `scrapedAt` | string | Always | UTC timestamp when the record was saved. |

`params` is an open object: its keys are supplied by Avito.ma and vary by category, so the dataset schema does not fix a key list. In the saved vehicle rows, `params` contains `regdate`, `mileage_exact`, `bv`, and `fuel`. `imageUrls` and `videoUrls` are arrays of public URLs, and `categoryId` may be either a string or a number.

The 10-row saved run includes `listId`, `description`, `location`, `city`, `category`, `sellerName`, `sellerType`, `params`, `isPremium`, `isUrgent`, `isHotDeal`, `position`, and `searchQuery` in every row. `price`, `monthlyPayment`, `currency`, `imageUrl`, and `imageUrls` appear in nine rows; `oldPrice` appears in three. The example is a real saved row from the 2026-10-25 run, with all values complete.

```json
{
  "id": "75397289",
  "listingId": "75397289",
  "listId": "56153271",
  "title": "Clio 4 manuelle",
  "listingUrl": "https://www.avito.ma/fr/2_mars/voitures_d_occasion/Clio_4_manuelle_56153271.htm",
  "description": "Voiture en très bon état",
  "price": 107000,
  "oldPrice": 78000,
  "monthlyPayment": 2219,
  "currency": "DH",
  "location": "Casablanca",
  "city": "Casablanca",
  "category": "Voitures d'occasion",
  "imageUrl": "https://content.avito.ma/classifieds/images/10156374841?t=images",
  "imageUrls": [
    "https://content.avito.ma/classifieds/images/10156374841?t=images",
    "https://content.avito.ma/classifieds/images/10156374844?t=images",
    "https://content.avito.ma/classifieds/images/10156374843?t=images",
    "https://content.avito.ma/classifieds/images/10156374842?t=images"
  ],
  "sellerName": "LAVAGE AUTO SAAD",
  "sellerType": "STORE",
  "params": {
    "regdate": "2019",
    "mileage_exact": "150,000 km",
    "bv": "Manuelle",
    "fuel": "Diesel"
  },
  "isPremium": false,
  "isUrgent": true,
  "isHotDeal": false,
  "url": "https://www.avito.ma/fr/2_mars/voitures_d_occasion/Clio_4_manuelle_56153271.htm",
  "position": 5,
  "searchQuery": "voiture",
  "searchUrl": "https://www.avito.ma/fr/casablanca/voitures",
  "scrapedAt": "2026-10-25T20:53:58.199Z"
}
```

### Run summary

**Run summary** is stored separately from the dataset in the run's key-value store under `OUTPUT`.

| Field | Meaning |
| --- | --- |
| `status` | Overall Actor run status. |
| `runStatus` | Canonical run status; matches `status`. |
| `dataStatus` | Completeness of the saved dataset rows: `COMPLETE`, `PARTIAL`, `NO_RESULTS`, or `FAILED`. |
| `datasetItems` | Dataset items saved for the run. |
| `diagnosticItems` | Diagnostic dataset rows; always 0 because diagnostics are not written to the dataset. |
| `diagnosticCount` | Operational issues recorded for the run. |
| `errorCount` | Errors recorded for the run. |
| `uniqueItems` | Unique listing records counted after de-duplication. |
| `requestedPages` | Pages requested from the source. |
| `found` | Whether the source returned at least one usable result. |
| `dataAvailable` | Whether source-backed data was saved. |
| `finishedAt` | UTC time the summary was written. |

| Status | Data status | Meaning |
| --- | --- | --- |
| `SUCCEEDED` | `COMPLETE` | Eligible results were saved without an extraction problem. |
| `SUCCEEDED` | `PARTIAL` | Some results were saved, but a later page or parse problem prevented a complete run. Saved rows remain available. |
| `SUCCEEDED` | `NO_RESULTS` | The source completed cleanly and returned no matching results. |
| `FAILED` | `FAILED` | A fatal error occurred before any usable result was saved. |

Example `OUTPUT` from the 2026-10-25 run:

```json
{
  "status": "SUCCEEDED",
  "runStatus": "SUCCEEDED",
  "dataStatus": "COMPLETE",
  "datasetItems": 10,
  "diagnosticItems": 0,
  "diagnosticCount": 0,
  "errorCount": 0,
  "uniqueItems": 10,
  "requestedPages": 1,
  "found": true,
  "dataAvailable": true,
  "finishedAt": "2026-10-25T20:53:58.743Z"
}
```

### Coverage and limitations

The Actor reads public Avito.ma search and listing HTML. It does not log in, call private APIs, solve CAPTCHAs, or bypass access controls. `startUrls` are treated as page targets: only the first `maxPages` URLs are used, so adding many URLs while leaving `maxPages` at 1 processes only the first one. When `startUrls` is empty, the Actor builds one URL per page from `query`, `category`, and `city`.

Search cards may omit prices, images, seller details, districts, or category identifiers. Missing values are omitted rather than estimated. `oldPrice` is uncommon, and a low `maxItems` can stop collection before later pages are read. Avito.ma can change its public page structure or block requests; those outcomes are summarized in `OUTPUT` and logs rather than turned into placeholder rows. `saveDebugHtml` writes raw page HTML for debugging and is not part of the normal dataset.

### Usage and support

Cost depends on Apify compute, the number of requested pages, response size, retries, and any optional proxy use. Start with one page and `maxItems` around 10; confirm the field shape, then raise `maxItems` or `maxPages`. A `maxPages` value of 0 is convenient for larger runs because the page bound grows with the item limit. See the Actor's Pricing tab for current account rates.

Use the [Actor Issues page](https://apify.com/w3crawler/avito-search-results-scraper/issues) to report a problem. Include the run ID, the input used, and the `OUTPUT` summary; do not include tokens, cookies, or private data. This Actor is not affiliated with or endorsed by Avito.ma. Use it only for public data and in accordance with Avito.ma's terms, robots guidance, and applicable law. Public listings can contain personal information; use the output only for lawful purposes.

# Changelog

This Actor's version history is a separate document: https://apify.com/w3crawler/avito-search-results-scraper/changelog.md

# Actor input Schema

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

Optional absolute HTTPS Avito.ma URLs. When provided they take precedence over query, category, and city.

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

Keyword query used when startUrls are omitted.

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

Avito category path used when startUrls are omitted.

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

Avito location path used when startUrls are omitted.

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

Maximum number of unique listing rows to emit.

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

Maximum public pages to request. Zero derives a bounded limit from maxItems.

## `requestTimeoutSecs` (type: `integer`):

Timeout for each public page request.

## `maxBytes` (type: `integer`):

Bound each direct response and fixture before parsing.

## `saveDebugHtml` (type: `boolean`):

Save the first successful public search page HTML to the debug_html key-value store record, up to maxBytes. Disabled by default.

## `includeSellerPhone` (type: `boolean`):

Publish seller phone numbers when they appear in public listings. OFF by default because phone numbers are personal data; enable only when you have a lawful basis and disclosure obligation.

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

Optional standard Apify Proxy configuration. Start without proxy and use ordinary proxy only when direct public access is blocked.

## Actor input object example

```json
{
  "query": "voiture",
  "category": "annonces",
  "city": "maroc",
  "maxItems": 50,
  "maxPages": 0,
  "requestTimeoutSecs": 30,
  "maxBytes": 5000000,
  "saveDebugHtml": false,
  "includeSellerPhone": false
}
```

# Actor output Schema

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

Dataset containing source-backed public Avito.ma listing records only.

## `debugHtml` (type: `string`):

Key-value store containing the first inspected public page HTML when saveDebugHtml is enabled.

## `output` (type: `string`):

JSON key-value-store record containing SUCCEEDED/FAILED run status, data status, counts, and operational error totals.

## `runSummary` (type: `string`):

Run status and counters stored by the Actor.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("w3crawler/avito-search-results-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("w3crawler/avito-search-results-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 '{}' |
apify call w3crawler/avito-search-results-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,w3crawler/avito-search-results-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/N0GFV2gT3AU7cDg2z/builds/kQ3N7KPXZr7uKdfOd/openapi.json
