Skip to main content

AvitoParserFree

Библиотека для парсинга объявлений с Avito.ru с использованием Playwright.

📌 Особенности

  • Парсинг объявлений по городу, запросу и странице
  • Сбор полной информации об объявлении (заголовок, цена, описание, продавец, доставка и т.д.)
  • Сохранение результатов в JSON базу данных
  • Поддержка куки для обхода ограничений
  • Поддержка пользовательского User-Agent
  • Блокировка загрузки изображений для ускорения работы

🚀 Установка

pip install avito-parser-free

После установки необходимо установить браузеры для Playwright:

playwright install chromium

📖 Использование

from avito_parser import AvitoPars, Database

# Создаем парсер
parser = AvitoPars(
    headless=True,          # False - показать окно браузера
    slow_mo=0,              # Замедление в миллисекундах (по умолчанию 0)
    log=True,               # Логирование (вкл. по умолчанию)
    logging_path="avitopars_log.log",  # Путь к файлу логов
    logging_level=logging.INFO         # Уровень логирования
)

# COOKIES от Avito (опционально, но с ними больше шансов обойти блокировку)
cookies = {
    # ваши куки
}

# User-Agent (опционально)
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"

# Пример использования №1: Сохраняем одну страницу
city_url = "tver"
query = "nokia 3310"
page = 1
local_priority = 1  # 1 - сначала объявления с указанного города, 0 - сначала рекомендуемые

db = Database(path=f"{city_url}_{page}_{local_priority}.json")
results = parser.search(city_url, query, page, local_priority, cookies, user_agent)

for item in results:
    db.write(item)

print("✅ Данные сохранены в базу данных")

# Пример использования №2: Сохраняем несколько страниц
city_url = "tver"
query = "nokia 3310"
local_priority = 1

db = Database(path=f"{city_url}_1_5_{local_priority}.json")

for page in range(1, 6):  # Сохраняем с 1 по 5 страницу
    results = parser.search(city_url, query, page, local_priority, cookies)
    for item in results:
        db.write(item)
    print(f"✅ Страница {page} сохранена!")

print("✅ Все данные сохранены в базу данных")

📁 Структура данных

Каждое объявление содержит следующие поля:

{
    "title": "Nokia 3310, 1 SIM",          // Заголовок
    "price": "2 500 ₽",                    // Цена
    "seller": "Имя продавца",              // Продавец
    "state": "Б/у",                        // Состояние
    "grade": "4.5",                        // Оценка
    "date": "Вчера",                       // Дата публикации
    "description": "Телефон в хорошем состоянии", // Описание
    "delivery": "Доставка от 2 дней",      // Доставка
    "url": "https://www.avito.ru/..."      // Ссылка на объявление
}

Metadata

Release files for avito-parser-free 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for avito-parser-free 0.1.1
File Size Uploaded Provenance
avito_parser_free-0.1.1.tar.gz 8.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for avito-parser-free 0.1.1
File Interpreter ABI Platform
avito_parser_free-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.4 kB

Release files / avito_parser_free-0.1.1.tar.gz

Download URL avito_parser_free-0.1.1.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c466c2d7440390fb11caaad2e96f1e68d922cedfcded78b195ed9c9660a7dd41
BLAKE2b-256 checksum
How to use checksums
cb6741fcb976c8f40ab1fb76c25dd50c0c83b64e82c88fe6b3c287140c243287
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release files / avito_parser_free-0.1.1-py3-none-any.whl

Download URL avito_parser_free-0.1.1-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a9b6a4c5968a50f612a0c1e07170c4f8587e491fd614c098b5ca754ff5dd87a
BLAKE2b-256 checksum
How to use checksums
0d967df7b8644f7565d1b949c870dd6c71ae8ad97846aa1d79a687a600b989e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Security for avito-parser-free 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page