# Avito Scraper (`server0/avito-scraper`) Actor

Scrapes search-result listings from Avito (avito.ru) by keyword, category, region and price range.

- **URL**: https://apify.com/server0/avito-scraper.md
- **Developed by:** [SilentHunter](https://apify.com/server0) (community)
- **Categories:** E-commerce, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 31 total users, 5 monthly users, 92.4% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 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?

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 Scraper (Apify Actor)

Scrapes **search-result listings** from [Avito](https://www.avito.ru) (avito.ru). You provide a
keyword, optional category/region and a price range; the actor builds the search URL, paginates
through results and stores each listing card in the dataset.

> Scope: search-result cards only. It does **not** open individual ad pages and does **not**
> collect phone numbers.

> ⚠️ **Proxies required.** Avito is geofenced and Cloudflare-protected — you need a large
> **Russian residential (or mobile)** IP pool (prefilled to Apify Residential, country `RU`).
> Without one the run collects nothing. See [Proxies](#proxies--important).

### Features

- **Structured search** — by keyword, region, category and price range, with sorting.
- **Or paste URLs** — feed ready-made Avito search/category URLs via `startUrls`.
- **HTTP-only engine** — Chrome-TLS-fingerprinted HTTP (impit) does everything: solves Avito's
  firewall **proof-of-work** challenge in-process, follows the keyword→category redirect and
  paginates. A headless browser is kept only as a last-resort fallback.
- **Rich data from Avito's own JSON** — exact price, posted date, GPS coordinates, category,
  photo count and seller rating; robust to HTML/markup changes.
- **Public data only** — listing cards, no phone numbers and no personal data.

### How it works

Avito guards its pages with two layers, and the actor handles both over plain HTTP:

1. **TLS fingerprinting** — plain Node HTTP clients are rejected. The actor uses **impit** (real Chrome
   **TLS + HTTP/2 fingerprint**, no browser) through `CheerioCrawler`.
2. **Firewall proof-of-work challenge** (HTTP 439, «Нужна небольшая проверка браузера») — a small
   SHA-256 puzzle normally solved by the page's JavaScript. The actor solves it **in-process** on the
   same session/IP (a few milliseconds), re-fetches, and the session stays unblocked for ~10 minutes.

A plain keyword search (`/{region}?q=...`) returns a shell whose embedded state names the canonical
category URL Avito would redirect to (`/all/{category}/…?context=…`). The actor follows that URL over
HTTP; it **is** server-side rendered with the cards and Avito's total count, so the remaining pages are
fanned out in parallel and fetched over HTTP too. Ready-made URLs from `startUrls` go through the same
flow.

Listings are parsed from the page's **embedded catalog JSON** (Avito's server-rendered state), which is
more robust than HTML scraping and carries richer fields (exact price, posted timestamp, coordinates,
category, photo count, seller rating). DOM selectors remain as a fallback.

The crawler rotates identities via Crawlee's `SessionPool`, retires blocked sessions (429 / hCaptcha
pages, dead proxy IPs) and retries generously — a failed attempt costs ~1–2 s, so a bad IP is just
skipped. Only if a start URL cannot be resolved over HTTP at all does a headless **Playwright** browser
step in as the last resort; the resolved URL it finds is handed back to the HTTP pass.

### Input

Provide a `keyword` **or** `startUrls`. A bare run with no input still works — it defaults to
`keyword: "iphone 15"` and Apify Residential (country `RU`) proxy.

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `keyword` | string | no | Search query (the `q` parameter). Defaults to `iphone 15` if neither `keyword` nor `startUrls` is given. |
| `startUrls` | array | no | Ready-made Avito search URLs (copy from your browser). Take precedence over `keyword`/`region`/`category` and bypass Avito's category redirect. |
| `region` | string | no | Region slug from the Avito URL. Default `rossiya` (all Russia). |
| `category` | string | no | Category slug. Empty = all categories. |
| `priceMin` | integer | no | Lower bound of the price range (→ `pmin`). |
| `priceMax` | integer | no | Upper bound of the price range (→ `pmax`). |
| `maxItems` | integer | no | Max listings to collect. Default `100`. |
| `sort` | string | no | Result order: `default`, `date` (newest), `priceAsc` (cheaper first), `priceDesc` (expensive first). Maps to Avito's `s` param. |
| `proxyConfiguration` | object | no\* | Proxy. Defaults to Apify Residential, country `RU`. |

\* A large Russian residential (or mobile) proxy pool is effectively required — without one the run
collects nothing. See [Proxies](#proxies--important).

#### Region / category slugs

Use the slugs exactly as they appear in an Avito URL, e.g.:

- Regions: `rossiya`, `moskva`, `sankt-peterburg`, `novosibirsk`, `ekaterinburg`
- Categories: `avtomobili`, `kvartiry`, `telefony`, `noutbuki`, `tovary_dlya_kompyutera`

Tip: open Avito in a browser, set your filters, and copy the path segments from the resulting URL.

#### Example input

```json
{
  "keyword": "iphone 15",
  "region": "moskva",
  "category": "telefony",
  "priceMin": 30000,
  "priceMax": 70000,
  "maxItems": 100,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"],
    "apifyProxyCountry": "RU"
  }
}
```

### Output

Each dataset item (fields are read from Avito's embedded catalog JSON):

```json
{
  "id": "7685094754",
  "title": "iPhone 17, 256 ГБ",
  "price": 53490,
  "priceString": "53 490 ₽",
  "currency": "RUB",
  "url": "https://www.avito.ru/ekaterinburg/telefony/iphone_17_256_gb_7685094754",
  "location": "Свердловская обл., Екатеринбург",
  "locationId": 654070,
  "lat": 56.830664,
  "lng": 60.589794,
  "categoryId": 84,
  "categorySlug": "telefony",
  "categoryName": "Телефоны",
  "postedDate": "2026-05-31T20:05:23.000Z",
  "postedTimestamp": 1780257923000,
  "imageUrl": "https://...",
  "photoCount": 7,
  "description": "iPhone 17, 256 ГБ. Оригинальный, запечатанный…",
  "sellerRating": 4.9,
  "sellerReviews": "3 252 отзыва",
  "isVerified": false,
  "isNew": false,
  "isPromoted": false,
  "category": "telefony",
  "region": "rossiya",
  "keyword": "iphone",
  "scrapedAt": "2026-05-31T12:00:00.000Z"
}
```

`category`/`region`/`keyword` echo your **search** input; `categorySlug`/`locationId`/etc. describe the
**listing** itself. Some fields can be empty for certain listings (e.g. `location`/`lat`/`lng` when Avito
hides the exact address — `locationId` is always present). If the embedded JSON is ever unavailable, the
DOM fallback fills the core fields (`id`, `title`, `price`, `url`, `location`, `imageUrl`).

### Proxies — important

Avito sits behind Cloudflare and rate-limits per IP. The TLS impersonation above defeats
*fingerprint*-based detection, but **IP reputation and per-IP rate limits still matter** — so the
proxy pool is decisive.

- **Apify Residential, country `RU`** — the prefilled default. Apify Proxy has no selectable "mobile"
  group, so residential is the strongest Apify-native option for Avito (its pool does include some
  mobile IPs, but they can't be isolated).
- **The pool must be large.** A handful of IPs gets detected and banned quickly; Avito's limits are
  aggressive. Prefer a big rotating residential pool.
- **Custom proxies for true mobile IPs.** Carrier (mobile) IPs are rate-limited by Avito far less
  aggressively, but Apify doesn't offer them as a group. To use them, pick "Custom proxies" in the
  proxy editor and paste URLs from an external mobile provider (e.g. BrightData mobile). Datacenter
  IPs can work *only* with a very large rotating pool.

Without a decent Russian IP pool the actor will mostly hit "Доступ ограничен" block pages regardless
of the engine.

### Running locally

```bash
npm install
npx playwright install chromium   # only needed for the last-resort browser fallback
apify login                       # required to use Apify residential proxies locally
apify run --purge                 # reads input from storage/key_value_stores/default/INPUT.json
```

Results land in `storage/datasets/default/`.

### Deploy

```bash
apify push
```

### FAQ

**Why are Russian proxies required?** Avito is geofenced and Cloudflare-protected; without a Russian
IP pool you mostly get "Доступ ограничен" block pages. See *Proxies* above.

**Does it launch a browser?** Normally no — the firewall challenge, the category redirect and
pagination are all handled over HTTP. A headless browser is started only as a last resort when a start
URL could not be resolved over HTTP at all.

**Does it collect personal data?** No. Only public listing fields (title, price, location, photos,
rating, etc.). No phone numbers and no seller contact details.

**Which regions and categories are supported?** Any — use the slugs from an Avito URL (see above).
Default region is `rossiya` (all Russia), all categories.

**Why are some `location` fields empty?** Avito hides the exact address for certain listings;
`locationId` is always present.

### Legal note

Avito's Terms of Service restrict automated scraping. This actor collects **only public listing
fields and no personal data** (no phone numbers, no seller contact details). You are responsible for
ensuring your use complies with Avito's terms and applicable law; keep request volumes modest.

# Changelog

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

# Actor input Schema

## `keyword` (type: `string`):

Поисковый запрос (параметр q на Авито). Обязателен, если не заданы startUrls.

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

Опционально. Готовые URL страниц результатов Авито (скопируйте из браузера). Если заданы, имеют приоритет над keyword/регионом/категорией и обходят редирект категории.

## `region` (type: `string`):

Slug региона из URL Авито: rossiya (вся Россия), moskva, sankt-peterburg, и т.д.

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

Опционально. Slug категории: avtomobili, kvartiry, telefony, и т.д. Пусто = все категории.

## `priceMin` (type: `integer`):

Нижняя граница коридора цен (→ pmin). Опционально.

## `priceMax` (type: `integer`):

Верхняя граница коридора цен (→ pmax). Опционально.

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

Сколько объявлений собрать максимум.

## `sort` (type: `string`):

Порядок сортировки результатов (параметр s на Авито).

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

Для Авито нужны российские прокси. По умолчанию — Apify Residential, страна RU. У Apify нет отдельной мобильной группы; для истинно мобильных IP выберите «Custom proxies» и вставьте URL своего провайдера (напр. BrightData mobile). Датацентровые блокируются.

## Actor input object example

```json
{
  "keyword": "iphone 15",
  "region": "rossiya",
  "maxItems": 100,
  "sort": "default",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "RU"
  }
}
```

# Actor output Schema

## `items` (type: `string`):

All collected Avito listing cards.

# 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 = {
    "keyword": "iphone 15",
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "RU"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("server0/avito-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 = {
    "keyword": "iphone 15",
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "RU",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("server0/avito-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 '{
  "keyword": "iphone 15",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "RU"
  }
}' |
apify call server0/avito-scraper --silent --output-dataset

```

## MCP server setup

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