# Avito.ma Morocco Classifieds Search Scraper (`codingfrontend/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/codingfrontend/avito-search-results-scraper.md
- **Developed by:** [Coding Frontned](https://apify.com/codingfrontend) (community)
- **Categories:** Automation, Developer tools, Real estate
- **Stats:** 1 total users, 0 monthly users, 66.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.99 / 1,000 results

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?

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

### What does the Avito.ma Morocco Classifieds Search Scraper do?

This Actor collects structured, publicly visible search results from [Avito.ma](https://www.avito.ma/), Morocco's classifieds marketplace. It is an **Avito.ma API alternative** for public search pages and supports keyword, category, and city filters without requiring private account data.

The Actor uses the public search page's embedded structured data when available and a small DOM fallback for listing links. If Avito.ma reports Cloudflare, CAPTCHA, login, paywall, geographic, rate-limit, device-verification, or access-denied protection, the Actor rotates a bounded session and then fails clearly. Failed runs never add synthetic diagnostic rows to the dataset.

### Why use this Avito.ma scraper?

- Search vehicles, real estate, electronics, and other public categories.
- Keep a stable listing ID and absolute listing URL for downstream deduplication.
- Capture public price, currency, location, category, seller label, media URLs, attributes, and listing flags when exposed.
- Limit both result count and inspected search pages with bounded input controls.
- Run on Apify with scheduling, API access, monitoring, webhooks, and proxy configuration.

### What data can the Actor extract?

| Field | Type | Description |
|---|---|---|
| `id` | string | Public listing identifier. |
| `title` | string | Public listing title. |
| `listingUrl` | string | Absolute Avito.ma listing URL. |
| `price`, `oldPrice`, `monthlyPayment` | number | Public price values when provided. |
| `currency` | string | Price currency label or code. |
| `location`, `city`, `district` | string | Public location fields. |
| `category`, `parentCategory` | string | Public category labels. |
| `imageUrls`, `videoUrls` | array | Public media URLs. |
| `sellerName`, `sellerType` | string | Public seller attribution when shown. |
| `params` | object | Public secondary listing attributes. |
| `isPremium`, `isUrgent`, `isHotDeal` | boolean | Public listing flags. |
| `searchQuery`, `scrapedAt` | string | Request and collection provenance. |

### How to scrape Avito.ma search results

1. Open the Actor and select the **Input** tab.
2. Enter a `query`, a category such as `voitures`, and optionally a city such as `casablanca`.
3. Set `maxItems`. Use `maxPages` when you want a stricter page bound; `0` derives a bounded limit from `maxItems`.
4. Keep the residential Morocco proxy default for cloud runs, or explicitly disable the proxy for local connectivity checks.
5. Start the run and download the dataset in JSON, CSV, Excel, or another supported format.

Use the **API** tab for programmatic runs. Scheduling and webhooks are useful for recurring public-market monitoring, while proxy configuration can be supplied through the input tab when permitted for your account and use case.

### How much does it cost to scrape Avito.ma?

Actor cost depends on Playwright compute time and the proxy configuration selected for the run. Smaller `maxItems` and `maxPages` values reduce browser time. Cloudflare or another access-control response fails the run after bounded retries, so plan for the source site's availability and any applicable Apify proxy charges.

### Input

See the input tab for full configuration options:

- `query`: optional keyword search.
- `category`: category path; defaults to `voitures` in the Actor logic.
- `city`: optional lower-cased city path.
- `maxItems`: 1–200 listings, default 50.
- `maxPages`: 0–10 public search pages, default 0 for a bounded automatic limit.
- `saveDebugHtml`: deprecated compatibility flag; raw page HTML is not persisted.
- `proxyConfiguration`: Apify proxy settings, defaulting to residential Morocco routing.

### Output

The dataset contains only verified listing records with an Avito.ma `.htm` URL, stable ID, title, page number, source search URL, and scrape timestamp. If public access is unavailable, the run fails and its dataset stays empty. The fixed `OUTPUT` key records counts and run status.

```json
{
  "position": 1,
  "id": "123456789",
  "title": "Example family car in good condition",
  "listingUrl": "https://www.avito.ma/fr/maroc/voitures/example-listing_123456789.htm",
  "price": 125000,
  "currency": "MAD",
  "city": "Casablanca",
  "category": "Cars",
  "source": "avito.ma",
  "sourceSearchUrl": "https://www.avito.ma/fr/casablanca/voitures?query=toyota",
  "page": 1,
  "scrapedAt": "2026-01-15T12:00:00.000Z"
}
```

### Tips, troubleshooting, and support

Use a reasonable limit and respect Avito.ma's terms, robots rules, and rate limits. A failed access-control run means the public page denied access; do not treat it as an empty successful search or attempt to bypass the protection. The Actor does not solve CAPTCHAs or use private sessions. For feedback, use the Issues tab and the API tab for integration questions.

### FAQ and disclaimer

#### Does this Actor access private seller information?

No. It reads only fields exposed on public search pages. A public phone number may appear when Avito.ma exposes it; do not use or retain personal data without a legitimate lawful purpose.

Our Actors are ethical and do not extract any private user data, such as email addresses, gender, or location. They only extract what the user has chosen to share publicly. We therefore believe that our Actors, when used for ethical purposes by Apify users, are safe. However, you should be aware that your results could contain personal data. Personal data is protected by the GDPR in the European Union and by other regulations around the world. You should not scrape personal data unless you have a legitimate reason to do so. If you're unsure whether your reason is legitimate, consult your lawyers.

# Actor input Schema

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

Keywords to search for on Avito.ma (e.g. 'voiture', 'appartement', 'iphone'). Leave empty to browse a category.

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

Category path to browse (e.g. 'voitures', 'immobilier', 'informatique-et-multimedia'). Used alongside or instead of the keyword query.

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

City to filter results (e.g. 'casablanca', 'rabat', 'marrakech'). Leave empty for all of Morocco.

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

Maximum number of listings to scrape.

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

Maximum number of public search pages to inspect. Use 0 to derive a bounded limit from maxItems.

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

Deprecated compatibility setting. Raw page HTML is not persisted.

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

Proxy configuration. Residential Morocco routing is the safe cloud default; explicitly disable it only for local testing.

## Actor input object example

```json
{
  "query": "voiture",
  "category": "voitures",
  "city": "casablanca",
  "maxItems": 50,
  "maxPages": 0,
  "saveDebugHtml": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "MA"
  }
}
```

# Actor output Schema

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

Dataset containing verified public listing records. Failed or blocked runs do not add synthetic rows.

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

JSON key-value-store record containing item counts and availability status.

# 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": "voiture",
    "category": "voitures",
    "city": "",
    "maxItems": 50,
    "maxPages": 0,
    "saveDebugHtml": false,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "MA"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("codingfrontend/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 = {
    "query": "voiture",
    "category": "voitures",
    "city": "",
    "maxItems": 50,
    "maxPages": 0,
    "saveDebugHtml": False,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "MA",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("codingfrontend/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 '{
  "query": "voiture",
  "category": "voitures",
  "city": "",
  "maxItems": 50,
  "maxPages": 0,
  "saveDebugHtml": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "MA"
  }
}' |
apify call codingfrontend/avito-search-results-scraper --silent --output-dataset

```

## MCP server setup

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