Avito Parser: How to Scrape Listings, Prices, and Sellers for Competitor Monitoring
Table of contents
- Introduction: what you'll get from this guide
- Preliminary setup: tools, access, requirements
- Basic concepts: how data collection from avito works
- Step 1: decide what to collect and from whom
- Step 2: connecting a mobile proxy and verifying the region
- Step 3: collecting listings from search results
- Step 4: enriching data from listing pages and collecting sellers
- Step 5: saving history and setting up monitoring
- Verifying the result: ready parser checklist
- Common mistakes and solutions
- Advanced features for advanced users
- Faq: answers to common questions
- Conclusion
Introduction: What You'll Get from This Guide
An Avito parser is a program that automatically opens marketplace pages, extracts listings, prices, specifications, and seller data, and stores everything in a spreadsheet or database. If you sell on Avito or compete with those who do, this tool replaces hours of manually scrolling through search results. In this step-by-step guide, we'll build a working Avito parser from scratch together: from an empty folder on your computer to a database with competitor price history and daily change tracking.
By the end, you'll have:
- a script that collects listings from Avito search results in a specified region based on a list of search queries;
- a second script that opens listing pages and enriches the data: description, specifications, seller type, rating, and number of active listings;
- a database with price history that shows who changed their price and when;
- a scheduled task that runs collection on a timetable, plus a simple change report.
Who this guide is for. Store owners and private sellers, marketers, analysts, and managers who need to see the entire Avito market. No programming experience required: all commands and code are provided in full, you just need to follow along carefully. For those who already know Python, at the end of each step and in the "Advanced Features" section there are ideas for making the tool more powerful.
What you need to know beforehand. How to open folders and files, copy text, and run a command line. Understanding what a web page and a link are. We'll explain everything else along the way.
How much time it takes. Setting up the environment takes about an hour. Your first working search results collection takes another hour or so. Listing pages, the database, and monitoring take another two to three hours including testing. If you do it all in one evening, it'll be a long but manageable evening. It's better to split it into two sessions: today through Step 3, tomorrow the rest.
An important caveat: we've previously published articles about mobile proxies for working with Avito and about automated listing posting. We won't repeat them here — we're only focused on data collection: what to collect, how to collect it carefully, and how to turn raw pages into useful analytics.
Preliminary Setup: Tools, Access, Requirements
Before writing the first line of code, let's gather everything we need. This section takes about half an hour.
What You'll Need
- A computer running Windows, macOS, or Linux. Any laptop from the last few years will do; the parser doesn't need powerful hardware. A few gigabytes of free disk space is enough.
- A stable internet connection. A home connection is sufficient, but we'll send requests to Avito through a mobile proxy — more on that below.
- Python version 3.10 or newer. This is the language we'll write the parser in.
- A code editor. Visual Studio Code or any other editor with syntax highlighting will work. In a pinch, regular Notepad will do, but it'll be less convenient.
- A browser with developer tools (Chrome, Yandex Browser, Firefox) — to see how Avito pages are structured.
- A mobile proxy with IP rotation via a link or on a timer. This guide uses a proxy from MobileProxy.Space, but any with similar features will work.
Installing Python
- Download the Python installer from the official project website for your operating system.
- Run the installer. On the first screen in Windows, be sure to check "Add python.exe to PATH" — it's at the bottom of the window. Without it, the python command won't be found from the command line.
- Click "Install Now" and wait for it to finish. This takes one to two minutes.
- Open the command line. In Windows, press Win+R, type cmd, and press Enter. In macOS, open "Terminal" via Spotlight. In Linux, open any terminal.
- Type
python --versionand press Enter. You should see a line like "Python 3.12.x". In macOS and Linux, you may needpython3 --version.
Creating the Project Folder and Virtual Environment
A virtual environment is a separate "sandbox" for the project's libraries, so they don't conflict with other programs on your computer.
- Create a folder, for example
C:/avito-parserin Windows or~/avito-parserin macOS and Linux. - In the command line, navigate to it:
cd C:/avito-parser. - Create the environment:
python -m venv venv. A venv subfolder will appear. - Activate the environment. In Windows:
venv/Scripts/activate. In macOS and Linux:source venv/bin/activate. The prompt will now start with (venv). - Install the libraries with one command:
pip install requests beautifulsoup4 lxml. Installation takes about a minute.
Check: after installation, run pip list. The list should include requests, beautifulsoup4, and lxml. If a library is missing, repeat the install command and read the error message — most often it's a lack of internet or the environment not being activated.
Backups
The parser doesn't change anything on your computer except files in the project folder, so a system backup isn't needed. But save copies of the database file before experimenting: once you've accumulated weeks of price history, losing it would hurt. Simply copy the database file into a separate folder with the date in the name.
The Legal Side: What You Can and Can't Collect
Attention: before starting collection, open and read Avito's user agreement and marketplace rules. Collect only publicly available information, don't create excessive load on the service, and don't try to obtain data that the marketplace doesn't show to a regular visitor. Also consider personal data protection laws: you must not collect or store phone numbers, names, and addresses of private individuals. You don't need this information for competitor analysis anyway — the store name, rating, number of listings, and prices are enough. If you plan to build a commercial product on the collected data, consult a lawyer.
Basic Concepts: How Data Collection from Avito Works
If this is your first time dealing with parsing, this section will save you a lot of time on the following steps. We'll explain the terms in plain language.
Key Terms
- Parsing (scraping) — automatically extracting data from web pages. The program requests a page just like a browser, receives its code, and picks out the needed pieces.
- HTML — the text code of a page. Every price and every listing title is wrapped in tags with attributes that let you find them.
- A selector — the "address" of an element within HTML. For example,
div[data-marker=item]means "all div blocks whose data-marker attribute equals item". That's exactly how Avito marks cards in search results. - Search results — the page of search results: a list of listings for a query in a region and category.
- A listing page — a separate page for one item with a full description, specifications, and seller block.
- Pagination — splitting search results into pages. On Avito, the page number is passed in the address via the p parameter.
- HTTP status — a short server response code. 200 is all good. 404 means the page doesn't exist. 403 and 429 mean the server refused or asks you to slow down.
- A proxy — an intermediary server through which your requests go. The site sees the proxy's address, not yours.
- A mobile proxy — a proxy whose internet access goes through a cellular modem. The IP address of such a proxy belongs to the carrier and changes periodically.
How an Avito Parser Works
The scheme is the same for any marketplace, and Avito is no exception:
- The program constructs the search results page address: region, category, search query, page number.
- It sends a request through the proxy with browser-like headers.
- It receives the HTML and extracts the list of listings using selectors: identifier, title, price, link.
- It pauses, then moves to the next page.
- For the needed listings, it opens the listing pages and enriches the record with the description and seller information.
- It saves everything to the database, compares with the previous run, and prepares a change report.
What You Need to Understand Before Starting
First. Avito's markup changes. The selectors we use work at the time of writing, but in a few months some attribute may be renamed. That's why we'll put all selectors in a separate settings file so you can edit them without rewriting the code. Knowing how to look into the browser's developer tools and find a new selector is the main skill you'll gain.
Second. Avito's search results depend on the request region. The marketplace selects listings and their order based on where the visitor came from. If you need competitor prices in a specific city, requests must come from addresses in that region. Mobile proxies with regional binding solve this directly: you simply select the city when buying a port.
Third. Care matters more than speed. The marketplace monitors load, and too-frequent requests from one address lead to 403 and 429 responses or a captcha page. This isn't a reason to "push through". It's a signal to stop, increase the pauses, and distribute the load. The goal of monitoring is to get data once or twice a day, not to download the entire site in an hour.
Step 1: Decide What to Collect and from Whom
Goal of this stage: create a precise list of queries, regions, and fields so the parser collects exactly what you need for decisions, not everything.
The most common mistake beginners make is starting with code. It's better to start with the question: what decision will you make based on the data? Want to know if your price is too high? See which competitors update listings most actively? Find new players in the niche? The answer determines both the set of fields and the collection frequency.
Instructions
- Create a text file
queries.txtin the project folder. - Write search queries in it, one per line, as buyers would type them. For example: "iphone 15 128", "mountain bike 29", "corner sofa reclining". Start with three to five queries, expand later.
- Open Avito in your browser, run one of the queries, and select the desired region and category. Look at the address bar. You'll see a structure like
https://www.avito.ru/moskva/telefony?q=iphone+15+128. Heremoskvais the region,telefonyis the category, andqis the query. - For each query, note the region and category as they appear in the address. Flip to the second page of results and verify that the
p=2parameter was added to the address. - Create a
config.jsonfile and fill it in using the example below. This is the single place for all settings: proxy, pauses, selectors, and the task list.
{
"proxy": "http://ЛОГИН:ПАРОЛЬ@ХОСТ:HTTP_ПОРТ",
"rotate_url": "ССЫЛКА_СМЕНЫ_IP_ИЗ_ЛИЧНОГО_КАБИНЕТА",
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0 Safari/537.36",
"pause_min": ЗАДАЙТЕ_САМИ,
"pause_max": ЗАДАЙТЕ_САМИ,
"max_pages": 3,
"tasks": [
{"region": "moskva", "category": "telefony", "query": "iphone 15 128"},
{"region": "sankt-peterburg", "category": "velosipedy", "query": "велосипед горный 29"}
],
"selectors": {
"item": "div[data-marker=item]",
"title": "[data-marker=item-title]",
"price": "[data-marker=item-price]",
"link": "a[data-marker=item-title]"
}
}The pause_min and pause_max fields are the pause range in seconds between requests. Put the numbers in yourself. The logic is: start with a noticeable pause of several seconds, watch the response statistics over the first runs, and only reduce it when all responses come back with status 200. If 403 or 429 appear, increase the pauses back. The max_pages field limits the number of search result pages per query; for price monitoring, the first two or three pages are usually enough.
Which Fields to Collect
The minimum set for competitor monitoring:
- listing identifier (it's in the listing page URL and in the data-item-id attribute);
- title;
- price as a number, without spaces and the ruble sign;
- link to the listing page;
- region and query by which the listing was found;
- date and time of collection.
An extended set, which we'll add in Step 4: description, specifications, seller name, seller type (company or private individual), rating, number of reviews, and the seller's active listings.
Tip: don't include everything collectible in the first version. First, achieve stable collection of six basic fields. Each new field is a new selector that can break and a new reason for debugging.
Check: you have queries.txt and config.json files, the config has at least two tasks with real regions and categories copied from the address bar.
Potential Problems
If you can't determine the category in the address — search results without a category also work: remove the part of the path after the region and leave only ?q=query. If the region in the address isn't in Latin characters but appears as part of the parameters, just copy the full address and use it as a template.
Step 2: Connecting a Mobile Proxy and Verifying the Region
Goal of this stage: all parser requests go through a mobile proxy in the desired region, you know how to change IP on a timer and via a link, and you understand how this affects collection.
Why an Avito Parser Needs a Mobile Proxy Specifically
Mobile proxies have two properties that matter for scraping Avito. First, the address belongs to a cellular carrier, and the site sees a regular smartphone user from the desired region — that's exactly how you get honest regional search results. Second, the address on the port changes periodically, so your parser's load is distributed across many addresses rather than hitting the server from a single IP. For scale: as of November 14, 2026, there are 2,196,242 IP changes per day across the entire MobileProxy.Space network, and the median number of unique addresses per modem per day is 95.
Setup Instructions
- Register in the proxy service's personal account and buy a port. When choosing, specify the region whose search results you want to see, and the carrier.
- After purchase, the port details will appear in your account: host, login, password, HTTP port, and the IP change link. Copy them into
config.jsonin theproxyandrotate_urlfields. - If your code or tool works via SOCKS5, remember the rule: as of September 22, 2026, the SOCKS5 port equals the HTTP port plus one. So with an HTTP port of 10000, the SOCKS5 port will be 10001. For our requests-based script, the HTTP port is enough.
- Set up IP rotation. As of September 22, 2026, two methods are available: on a timer and via a link or API. For monitoring, choose the timer: set the interval in the port settings. For reference: as of November 14, 2026, the median interval between timer rotations is 120 seconds, and timer rotations account for 51.1 percent of all changes on the network.
- Create a
check_proxy.pyfile with the following content and run it with the commandpython check_proxy.py.
import json
import requests
with open('config.json', encoding='utf-8') as f:
cfg = json.load(f)
proxies = {'http': cfg['proxy'], 'https': cfg['proxy']}
r = requests.get('https://httpbin.org/ip', proxies=proxies, timeout=30)
print('Статус:', r.status_code)
print('Внешний IP через прокси:', r.json().get('origin'))You'll see status 200 and an IP address in the response. This is the modem's address, not your home one. Run the script again after a couple of minutes: with the timer enabled, the address should change.
Changing IP via a Link from Code
Sometimes you need to change the address at a specific moment rather than on schedule — for example, before starting collection for a new region or after a long pause. For this, the service provides a link: just make a GET request to it. Add a rotate.py file to the project:
import json
import time
import requests
with open('config.json', encoding='utf-8') as f:
cfg = json.load(f)
def rotate_ip():
r = requests.get(cfg['rotate_url'], timeout=30)
print('Команда смены IP отправлена, ответ:', r.status_code)
time.sleep(6)
if __name__ == '__main__':
rotate_ip()Why wait a few seconds after the command: as of November 14, 2026, the average duration of an IP change from command to new address is 4.56 seconds, and 80.8 percent of changes complete within 5 seconds. If you send the next request to Avito immediately, it may still go out from the old address.
Attention: don't call the IP change link several times in a row. As of November 14, 2026, 1.2 percent of link rotation records are duplicates, where the command is repeated within two seconds and the port gets the same address. One command — one pause — continue working.
Choosing a Carrier
Different carriers provide different address pools. As of November 14, 2026, per day, Beeline modems show 106,782 unique IPs, MegaFon 65,541, Tele2 56,412, and MTS 39,111. The larger the pool, the less often the same address repeats during the day. For monitoring one or two niches this isn't critical, but if you have many tasks, it makes sense to get ports from different carriers and distribute requests between them.
Tip: get one port per region rather than one port for everything. That way you know for sure that search results for St. Petersburg were collected from a St. Petersburg address, and you don't confuse regions when analyzing prices.
Check: the check_proxy.py script returns status 200 and an address different from your home one; a repeat run after the timer interval shows a different address; rotate.py runs without errors.
Potential Problems
- ProxyError or timeout. Check that there are no extra spaces in the proxy string, that the login and password are copied in full, and that the port specified is HTTP, not SOCKS5.
- Status 407. Incorrect credentials. Re-copy them from your account.
- The address doesn't change on the timer. Make sure the timer is enabled in the port settings and an interval is specified. More time than the interval must pass between two check runs.
Step 3: Collecting Listings from Search Results
Goal of this stage: the script goes through all tasks from the config, pages through search results, and saves listings to a CSV file with basic fields.
How to Find Selectors Yourself
Before trusting the selectors in the config, verify them in the browser — this is a skill that will come in handy with any markup change.
- Open the Avito search results page in Chrome.
- Press F12 — the developer tools panel will open.
- Click the cursor icon in the top-left corner of the panel (or Ctrl+Shift+C) and click on any listing title.
- The panel will highlight the tag. Look at its attributes: you'll see
data-marker="item-title". Move up the tree and find the block withdata-marker="item"and thedata-item-idattribute — that's the entire listing card. - Similarly, click on the price: it will have
data-marker="item-price". - Press Ctrl+F in the Elements panel and type
data-marker="item". The number of matches should roughly correspond to the number of listings on the page.
If the attributes are named differently, put what you saw into config.json. The code below reads selectors from the config, so you won't have to change it.
Search Results Collector Code
Create a search.py file and paste the code in full:
import csv
import json
import random
import time
from datetime import datetime
from urllib.parse import quote_plus
import requests
from bs4 import BeautifulSoup
with open('config.json', encoding='utf-8') as f:
cfg = json.load(f)
HEADERS = {
'User-Agent': cfg['user_agent'],
'Accept-Language': 'ru-RU,ru;q=0.9',
'Accept': 'text/html,application/xhtml+xml',
}
PROXIES = {'http': cfg['proxy'], 'https': cfg['proxy']}
SEL = cfg['selectors']
def pause():
time.sleep(random.uniform(cfg['pause_min'], cfg['pause_max']))
def build_url(task, page):
base = f"https://www.avito.ru/{task['region']}/{task['category']}"
return f'{base}?q={quote_plus(task["query"])}&p={page}'
def fetch(url):
r = requests.get(url, headers=HEADERS, proxies=PROXIES, timeout=40)
if r.status_code in (403, 429):
raise RuntimeError(f'Сервер ограничил доступ: {r.status_code}')
r.raise_for_status()
if 'Доступ ограничен' in r.text or 'captcha' in r.text.lower():
raise RuntimeError('Получена проверочная страница, остановитесь и снизьте нагрузку')
return r.text
def price_to_int(text):
digits = ''.join(ch for ch in text if ch.isdigit())
return int(digits) if digits else None
def parse_search(html, task):
soup = BeautifulSoup(html, 'lxml')
rows = []
now = datetime.now().isoformat(timespec='minutes')
for card in soup.select(SEL['item']):
item_id = card.get('data-item-id')
title_el = card.select_one(SEL['title'])
price_el = card.select_one(SEL['price'])
link_el = card.select_one(SEL['link'])
if not item_id or not title_el:
continue
href = link_el.get('href', '') if link_el else ''
if href.startswith('/'):
href = 'https://www.avito.ru' + href
rows.append({
'item_id': item_id,
'title': title_el.get_text(strip=True),
'price': price_to_int(price_el.get_text()) if price_el else None,
'url': href,
'region': task['region'],
'query': task['query'],
'collected_at': now,
})
return rows
def main():
all_rows = []
for task in cfg['tasks']:
for page in range(1, cfg['max_pages'] + 1):
url = build_url(task, page)
print('Загружаю', url)
try:
html = fetch(url)
except RuntimeError as e:
print('Остановка задачи:', e)
break
rows = parse_search(html, task)
print(' найдено объявлений:', len(rows))
if not rows:
break
all_rows.extend(rows)
pause()
if not all_rows:
print('Ничего не собрано, проверьте селекторы и прокси')
return
fname = 'search_' + datetime.now().strftime('%Y%m%d_%H%M') + '.csv'
with open(fname, 'w', newline='', encoding='utf-8-sig') as f:
w = csv.DictWriter(f, fieldnames=list(all_rows[0].keys()))
w.writeheader()
w.writerows(all_rows)
print('Сохранено строк:', len(all_rows), 'в файл', fname)
if __name__ == '__main__':
main()How to Run It
- Make sure the environment is activated: the command line prompt starts with (venv).
- Run
python search.py. - Watch the output. For each page, the address and the number of found listings are printed. The script pauses between pages — don't worry about the silence.
- When finished, you'll see a message "Сохранено строк" and the file name. Open it in Excel or another spreadsheet program. The utf-8-sig encoding is chosen so Russian letters open in Excel without garbled characters.
Walking Through the Key Code Parts
- The User-Agent header tells the site which browser you're using. Without it, the request looks like a "naked" program and is more likely to get refused. Use a current string from your browser: you can see it in the developer panel on the Network tab.
- The fetch function immediately stops the task on 403 and 429 statuses and when a verification page appears. This is done deliberately: continuing in such a state is pointless and impolite to the marketplace. The right reaction is to stop, wait for the IP to change on the timer, increase the pauses, and run collection later.
- The price_to_int function turns the string "12 990 ₽" into the number 12990. Without this, prices can't be compared or charted.
- Stopping on an empty page protects against endless paging when there are fewer listings in the results than max_pages.
Tip: for the first run, do it with one task and max_pages set to 1. Make sure the CSV fills correctly, and only then expand the list. That way you don't waste limits and the marketplace's patience on debugging.
Tip: save the first page's HTML to a file when debugging. Add the line open('last.html', 'w', encoding='utf-8').write(r.text) to fetch — and if the selectors return nothing, you can open last.html in the browser and see what actually came back.
Check: there's a CSV file in the project folder with the headers item_id, title, price, url, region, query, collected_at; prices are integers; the links open in the browser and lead to the right listings.
Potential Problems
- Found listings: 0 with status 200. The markup differs from the selectors in the config. Save the HTML, find the card in the developer panel, and update the selectors.
- Prices are empty. The price selector points to a wrapper, not to the text. Try
[data-marker=item-price] meta[itemprop=price]and read the content attribute, or take the text of the nearest child span. - RuntimeError 403 on the first request. Check that the proxy is connected (Step 2), the headers are in place, and the port hasn't been used just before in another intensive task. Let the port "rest" and try after an IP change on the timer.
Step 4: Enriching Data from Listing Pages and Collecting Sellers
Goal of this stage: based on the list of listings from the CSV, the script opens listing pages, extracts the description, specifications, and public seller information, and then saves an extended table.
What's on the Listing Page
Open any listing in the browser and walk through it with the developer panel. You'll usually find:
- the title in the h1 tag;
- the price in an element with the
itemprop="price"attribute or in a block with a data-marker containing the word price; - the description in a block with a data-marker containing description;
- a list of specifications as "name — value" pairs;
- the seller block: name, "Company", "Store", or "Private individual" label, rating, number of reviews, link to the seller's page with the number of listings.
Besides visual blocks, the page code often has service JSON with the same data inside a script tag. It can be parsed directly, but it changes more often than the markup, so for the first version we'll stick with selectors.
Adding Selectors to the Config
Extend the selectors section in config.json with keys for listing pages. The names below are examples; substitute the ones you saw in the browser:
"card_title": "h1",
"card_price": "[itemprop=price]",
"card_description": "[data-marker=item-view/item-description]",
"card_params": "[data-marker=item-view/item-params] li",
"seller_name": "[data-marker=seller-info/name]",
"seller_label": "[data-marker=seller-info/label]",
"seller_rating": "[data-marker=seller-info/score]",
"seller_link": "[data-marker=seller-info/name] a"Listing Page Collector Code
Create a cards.py file:
import csv
import glob
import json
import random
import time
import requests
from bs4 import BeautifulSoup
with open('config.json', encoding='utf-8') as f:
cfg = json.load(f)
HEADERS = {'User-Agent': cfg['user_agent'], 'Accept-Language': 'ru-RU,ru;q=0.9'}
PROXIES = {'http': cfg['proxy'], 'https': cfg['proxy']}
SEL = cfg['selectors']
def pause():
time.sleep(random.uniform(cfg['pause_min'], cfg['pause_max']))
def text_or_empty(soup, selector):
el = soup.select_one(selector)
return el.get_text(' ', strip=True) if el else ''
def parse_card(html):
soup = BeautifulSoup(html, 'lxml')
params = []
for li in soup.select(SEL['card_params']):
params.append(li.get_text(' ', strip=True))
link_el = soup.select_one(SEL['seller_link'])
seller_url = link_el.get('href', '') if link_el else ''
if seller_url.startswith('/'):
seller_url = 'https://www.avito.ru' + seller_url
return {
'description': text_or_empty(soup, SEL['card_description'])[:1000],
'params': ' | '.join(params),
'seller_name': text_or_empty(soup, SEL['seller_name']),
'seller_label': text_or_empty(soup, SEL['seller_label']),
'seller_rating': text_or_empty(soup, SEL['seller_rating']),
'seller_url': seller_url,
}
def main():
latest = sorted(glob.glob('search_*.csv'))[-1]
with open(latest, encoding='utf-8-sig') as f:
rows = list(csv.DictReader(f))
print('Карточек к обработке:', len(rows))
out = []
for i, row in enumerate(rows, 1):
print(f'{i}/{len(rows)}', row['url'])
try:
r = requests.get(row['url'], headers=HEADERS, proxies=PROXIES, timeout=40)
if r.status_code in (403, 429):
print('Доступ ограничен, останавливаюсь')
break
r.raise_for_status()
row.update(parse_card(r.text))
except Exception as e:
print(' пропуск:', e)
out.append(row)
pause()
fname = latest.replace('search_', 'cards_')
with open(fname, 'w', newline='', encoding='utf-8-sig') as f:
w = csv.DictWriter(f, fieldnames=list(out[0].keys()))
w.writeheader()
w.writerows(out)
print('Сохранено в', fname)
if __name__ == '__main__':
main()Run python cards.py. The script will take the freshest search_*.csv file, go through the links, and save the result to cards_*.csv. Walking through listing pages is the longest part: with several dozen listings and honest pauses, it will take tens of minutes. Schedule it for a time when the computer isn't needed.
Collecting Seller Data
For competitor monitoring, the seller matters more than the individual listing. For each unique seller_url, collect a separate record: name, type, rating, number of reviews, number of active listings, date of first and last appearance in your search results. The number of active listings is usually shown on the seller's page; add a selector for it by the same principle and a small script modeled on cards.py that goes only through unique seller_urls.
Attention: on the listing page there's a "show phone" button. Don't try to get the number programmatically: it's personal data, collecting it without consent violates the law, and you don't need it for price analysis. Stick to what the seller publishes as business information: store name, rating, number of listings.
Tip: process listing pages not for all listings, but only for new ones. In Step 5 we'll set up the database, and before running cards.py you'll be able to filter out item_ids that are already in it with a filled-in description. This cuts the number of requests dramatically and makes monitoring easier on the marketplace.
Check: in the cards_*.csv file, most rows have description, seller_name, and seller_label filled in; seller_label values contain words like "Company", "Store", or "Private individual"; seller_url links open.
Potential Problems
- The description is empty although it's on the page. The description may be loaded by a script after the page is rendered. Look in the developer panel on the Network tab to see which request brings the text, or use the browser automation option from the "Advanced Features" section.
- A seller without a rating. New or private sellers may not have a rating. That's normal, leave the field empty.
- A high proportion of skips. You're going through listing pages too fast. Increase the pauses and wait for the next IP change on the timer.
Step 5: Saving History and Setting Up Monitoring
Goal of this stage: data accumulates in a database, with price history for each listing, a comparison script shows what changed since the last run, and the scheduler runs collection without your involvement.
Why CSV Isn't Enough
While you're collecting data once, CSV is convenient. But for monitoring, you need to compare runs: which listings appeared, which disappeared, whose price changed. For this we use SQLite — a database built into Python that's stored in a single file and doesn't require installing a server.
Database Loading Code
Create a db.py file:
import csv
import glob
import sqlite3
DB = 'avito.sqlite'
def init():
con = sqlite3.connect(DB)
con.execute('''CREATE TABLE IF NOT EXISTS listings (
item_id TEXT PRIMARY KEY, title TEXT, url TEXT, region TEXT, query TEXT,
seller_name TEXT, seller_label TEXT, seller_url TEXT,
description TEXT, params TEXT,
first_seen TEXT, last_seen TEXT, last_price INTEGER)''')
con.execute('''CREATE TABLE IF NOT EXISTS price_history (
item_id TEXT, price INTEGER, collected_at TEXT)''')
con.commit()
return con
def load(con, rows):
for r in rows:
price = int(r['price']) if r.get('price') else None
old = con.execute('SELECT last_price FROM listings WHERE item_id=?', (r['item_id'],)).fetchone()
if old is None:
con.execute('''INSERT INTO listings VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)''', (
r['item_id'], r['title'], r['url'], r['region'], r['query'],
r.get('seller_name', ''), r.get('seller_label', ''), r.get('seller_url', ''),
r.get('description', ''), r.get('params', ''),
r['collected_at'], r['collected_at'], price))
con.execute('INSERT INTO price_history VALUES (?,?,?)', (r['item_id'], price, r['collected_at']))
else:
con.execute('UPDATE listings SET last_seen=?, last_price=?, title=? WHERE item_id=?',
(r['collected_at'], price, r['title'], r['item_id']))
if old[0] != price:
con.execute('INSERT INTO price_history VALUES (?,?,?)', (r['item_id'], price, r['collected_at']))
con.commit()
if __name__ == '__main__':
con = init()
files = sorted(glob.glob('cards_*.csv')) or sorted(glob.glob('search_*.csv'))
with open(files[-1], encoding='utf-8-sig') as f:
load(con, list(csv.DictReader(f)))
print('Объявлений в базе:', con.execute('SELECT COUNT(*) FROM listings').fetchone()[0])Run python db.py. An avito.sqlite file will appear in the folder, and the console will show the number of listings in the database. Repeat runs don't create duplicates: the listing is updated, and only the change goes into price history.
Change Report
Create a report.py file that answers three questions: what went up or down in price, what appeared, what disappeared.
import sqlite3
from datetime import datetime, timedelta
con = sqlite3.connect('avito.sqlite')
since = (datetime.now() - timedelta(days=1)).isoformat(timespec='minutes')
print('=== Изменения цен за сутки ===')
q = '''SELECT l.title, l.seller_name, h.price, h.collected_at, l.url
FROM price_history h JOIN listings l ON l.item_id = h.item_id
WHERE h.collected_at >= ? ORDER BY h.collected_at DESC'''
for row in con.execute(q, (since,)):
print(row)
print('=== Новые объявления ===')
for row in con.execute('SELECT title, seller_name, last_price, url FROM listings WHERE first_seen >= ?', (since,)):
print(row)
print('=== Пропавшие из выдачи (не видны больше трёх дней) ===')
old = (datetime.now() - timedelta(days=3)).isoformat(timespec='minutes')
for row in con.execute('SELECT title, seller_name, last_price FROM listings WHERE last_seen < ?', (old,)):
print(row)
print('=== Продавцы по числу объявлений в вашей выдаче ===')
for row in con.execute('''SELECT seller_name, seller_label, COUNT(*) c FROM listings
WHERE seller_name != '' GROUP BY seller_name ORDER BY c DESC LIMIT 20'''):
print(row)The last block is the competitor map: who most often appears in search results for your queries, whether they're companies or private individuals, and how they move prices.
Scheduled Runs
Combine everything into one run_all.py file that calls search, cards, db, and report in sequence. The easiest way is through the subprocess module: four calls to subprocess.run(['python', 'search.py']) and so on in order. Then:
- Windows. Open "Task Scheduler" via the Start menu search. Click "Create Basic Task". Enter a name, choose "Daily", and set a time, such as early morning. The action is "Start a program". In the "Program/script" field, specify the full path to
venv/Scripts/python.exe, in the "Add arguments" field —run_all.py, and in the "Start in" field — the project folder. - macOS and Linux. In the terminal, run
crontab -eand add a line like0 7 * * * cd /path/to/avito-parser && venv/bin/python run_all.py >> log.txt 2>&1. The task will run every day at seven in the morning and write the output to log.txt.
Tip: stagger the tasks in time. If you have several regions and ports, don't run everything at once: let Moscow collect at seven and St. Petersburg at eight. The load is distributed, and the reports don't get mixed up.
Tip: add sending the report to your messenger or email. For this, it's enough to assemble the report text into a string and send it via a bot API or through the standard smtplib module. Then you'll see competitor price changes on your phone in the morning without opening your computer.
Check: after two runs on different days, the price_history table contains records with different dates; report.py prints new listings and price changes; the scheduler task shows the last run status as "Success", and fresh CSVs appear in the folder.
Potential Problems
- The scheduler task doesn't run. Most often it's a wrong path to python.exe or a missing working folder. Run run_all.py manually from the same folder and make sure it works.
- The database grows but there's no history. Check that the load loop compares numbers, not strings: the price field in the CSV is read as text, so it's converted to int before comparison.
- The report is empty. Less than a day has passed between runs, or prices haven't changed. Increase the window in report.py to several days.
Verifying the Result: Ready Parser Checklist
Go through the list. If the answer to each item is "yes", your Avito parser is ready for daily work.
- config.json has the proxy, IP change link, pauses, tasks, and selectors filled in.
- check_proxy.py shows a mobile carrier address in the desired region, and the address changes on the timer.
- search.py collects search results for all tasks without 403 and 429 statuses, and the CSV contains prices as numbers.
- cards.py enriches records with descriptions and seller info, with a low proportion of skips.
- db.py loads data without duplicates; a repeat run only increases last_seen and history.
- report.py shows meaningful changes, and the seller list matches what you see in the search results yourself.
- The scheduler runs run_all.py on schedule, and there are no errors in log.txt.
- The database file is regularly copied to a backup folder.
How to Test Honestly
- Pick one competitor listing and note its price.
- Run collection twice with a day's interval.
- Compare the price from the database with the price on the site in the browser at the same moment. They should match.
- Open the search results in the browser from the same region and compare the first ten listings with the first ten in your CSV. The order may differ slightly due to personalization, but the composition should be similar.
- Deliberately break one selector in the config and run search.py. The script should honestly report that nothing was collected rather than crashing with an unclear error. Put the selector back.
Success Indicators
A good monitoring parser works quietly: it brings fresh data every day, doesn't catch refusals from the marketplace, and doesn't require your attention. If you haven't opened log.txt once in a week to sort out an error, everything is done right. If refusals appear regularly, go back to the pause settings and timer interval: collection should look like casual browsing, not an assault.
Common Mistakes and Solutions
Problem: Empty Result with Status 200
Cause: Avito's markup has changed, and the selectors don't find elements. Solution: save the HTML of the last response, open it in the browser, find the card through the developer panel, and update the attributes in config.json. No code changes needed.
Problem: Status 403 or 429 on the First Requests
Cause: request frequency too high, missing browser headers, or the port was just used in another load. Solution: stop collection, increase pauses, check the User-Agent header, wait for the scheduled IP change, and run again. Don't try to "break through" the restriction with repeats — it will make things worse for the port.
Problem: A Verification Page Appeared
Cause: the marketplace considered the request stream suspicious. Solution: the same as above: pause, reduce intensity, fewer pages per task. You don't need to and shouldn't solve the verification automatically — the goal of monitoring is to never get there.
Problem: Search Results Don't Match the Region
Cause: the proxy is bought for a different region, or the request goes around the proxy. Solution: run check_proxy.py and make sure the address belongs to a carrier in the desired region; check that proxies is passed in search.py.
Problem: Prices Are Saved as Text or with Errors
Cause: there are several numbers in the card, for example the price and the discount, or the selector grabs an extra block. Solution: refine the selector to the element with the itemprop=price attribute and read the content attribute, where the price is already a number.
Problem: Duplicate Listings in the Database
Cause: the same listing appears in several queries, and item_id is read with extra spaces. Solution: clean item_id with strip() before writing; duplicates across different queries aren't an error, they collapse on the primary key.
Problem: Excel Shows Garbled Characters
Cause: the file is saved without an encoding marker. Solution: use utf-8-sig encoding, as in the examples, or import the CSV via "Data — From Text" specifying UTF-8.
Problem: The Script Hangs on One Request
Cause: no timeout, or the proxy is in the middle of an IP change. Solution: always pass timeout to requests.get and wrap the request in try/except; on error, wait a few seconds and retry once, then skip.
Advanced Features for Advanced Users
Browser Automation Instead of requests
If some data is loaded by scripts and isn't in the HTML, use Playwright: install it with pip install playwright and then playwright install chromium. Playwright opens a real browser, waits for the page to load, and returns the final HTML, which you can feed to the same parse_search and parse_card functions. In Playwright, the proxy is passed when launching the browser via the proxy parameter with server, username, and password fields. The downside of this approach is that it's noticeably slower and heavier on traffic, so use it selectively, for listing pages, and keep collecting search results via requests.
Multiple Ports and a Task Queue
When tasks become many, add a list of proxies to the config and bind each task to its own port by region. You can run tasks in parallel, but each must go through its own port and its own pauses — otherwise the point of load distribution is lost. For the queue, the standard concurrent.futures module with a small number of threads, equal to the number of ports, will do.
Normalization and Product Matching
The main analytical task is to understand that a competitor's "iPhone 15 128 GB black" listing and your "iPhone 15 128gb black" are the same product. Convert titles to lowercase, remove extra characters, extract key attributes (model, storage, color), and compare by them. Simple rules are enough to start; then you can add a fuzzy string matching library.
Visualization
Export the price_history table to Excel or Google Sheets and build a price chart for each competitor. In a couple of weeks, you'll see patterns on it: who lowers prices on weekends, who raises them after sales, who holds the level. For automatic charts, install matplotlib and add image saving to report.py.
Rule-Based Alerts
Add rules: "if a competitor's price becomes lower than mine by more than a certain percentage — notify", "if a new store with many listings appears for my query — notify". Rules are just conditions in report.py; notifications are a messenger message or email.
Mobile API and Saving Traffic
The Avito mobile app has its own data exchange format, which is more compact than HTML. It's harder to parse, and it changes more often, so for most monitoring tasks it's wiser to stay with HTML, but disable image and extra resource loading — requests doesn't do it anyway, and in Playwright you can block image requests.
FAQ: Answers to Common Questions
Is It Even Legal to Build an Avito Parser?
Collecting publicly available information isn't prohibited in itself, but the marketplace restricts automated access in its rules, and the law protects personal data. Collect only public business data, don't create load, and don't store private individuals' data. For commercial projects, consult a lawyer.
Can I Do Without a Proxy?
For one-off checks of a few pages — yes. For daily monitoring of several regions — no: you won't get regional search results, and all the load will fall on a single home address.
Timer or Link: Which IP Change Method to Choose?
For scheduled collection — the timer: the port changes the address itself, and the code doesn't get complicated. The link is useful when you need to start a new task from a "clean" address. As of September 22, 2026, both methods are available on every port.
What Pause Between Requests Should I Set?
There's no universal number: it depends on the category, region, and time of day. Start with a noticeable pause of several seconds, watch the proportion of 200 responses in the log, and reduce it gradually. As soon as 403, 429, or a verification appears — go back to the previous value.
How Many Search Result Pages Should I Collect?
For price monitoring, the first two or three pages are enough: those are what buyers see. Deep collection is only needed for researching the entire market, and it's better to do it rarely.
How Do I Collect Sellers If the Names Are All the Same, Like "User"?
Use seller_url as the unique key — it contains the seller identifier. Store the name as an additional field.
What If the Markup Breaks and the Script Stops Collecting?
Save the HTML, find the new attributes in the developer panel, and update config.json. That's exactly why the selectors are outside the code.
Can I Do Everything Without Programming?
There are ready-made parser programs and cloud services with their own interface. They're faster to start with, but you don't control the request frequency, the set of fields, or regionality. If code scares you, start with a ready-made tool, and when you realize what data is missing, come back to this guide.
How Do I Know the Collected Prices Are Reliable?
Regularly spot-check several listings against the site manually. Verify that the proxy region matches the task region and that the price field has no extra digits from discounts and installments.
Should I Store Listing Descriptions?
For prices — no. For analyzing how competitors describe products and which specifications they emphasize — yes. Limit the length, as in the example, so the database doesn't grow too large.
Conclusion
You've gone from an empty folder to a working Avito parser. Let's briefly recall what was done: defined goals and the list of queries, prepared the environment, connected a mobile proxy with regional binding and set up IP rotation on a timer, collected search results into CSV, enriched them with listing page and seller data, moved everything into a database with price history, and scheduled collection with a daily report.
What to do next. For the first week, just observe: read the reports, verify prices manually, fix selectors if something changed. Then add alert rules that matter specifically for your business, and expand the list of queries. In a month, you'll have your own picture of the market in your niche that your competitors don't have.
Where to grow. Master Playwright for complex pages, learn to match products by specifications, connect charts and alerts. And most importantly — stay careful: the calmer the parser works, the longer it will bring data without extra hassle. Happy monitoring!