Commit graph

3 commits

Author SHA1 Message Date
d03c96a79a fix(scrapers): yandex area из embedded-state JSON (Refs #775)
Часть A (#24): yandex_realty.py парсил площадь из RAW-HTML (regex), пустого до
JS-гидрации → 82% NULL area. _parse_html теперь извлекает {offer_id: area_m2}
из <script id=initial_state_script> (или application/json) раз на страницу и
использует preferentially в _card_to_lot; DOM-regex остаётся fallback'ом.
4 offer-path + 5 area-полей (incl nested {value}). 6 тестов.

Часть B (#23, cian buildingCadastralNumber): УЖЕ реализовано — cian.py:291
читает offer.buildingCadastralNumber, :456 пишет в ScrapedLot, поле base.py:109
существует, тест test_cian_serp_cadastral_numbers зелёный. Изменений не нужно
(премиса аудита устарела). cian.py НЕ трогался.

ruff clean; pytest -k 'yandex or cian' 365 pass (+1 pre-existing unrelated fail
test_cian_valuation low_price mock, не из этого PR).
2026-05-30 19:35:13 +03:00
aa70e9e155 fix(tradein): yandex_realty captures house number + parse_rub strips NBSP (#593)
All checks were successful
Deploy Trade-In / changes (push) Successful in 5s
Deploy Trade-In / build-frontend (push) Has been skipped
Deploy Trade-In / build-backend (push) Successful in 55s
Deploy Trade-In / deploy (push) Successful in 42s
2026-05-27 07:23:36 +00:00
lekss361
ead2ac16c5 feat(tradein): yandex_realty.py — DOM SERP refactor (vtorichka, 23 cards/page)
Replace dead JSON-state extraction (Yandex moved to chunked/ephemeral state
post-hydration) with selectolax DOM parsing using helpers from PR #456.

Changes:
- New URL: /{city}/kupit/kvartira/vtorichniy-rynok/?page=N (path-based, no geo)
- Selector: [data-test="OffersSerpItem"] x ~23 per page
- Per-card extraction: offer_id (URL regex), title (rooms/area/floor regex),
  price/ppm2 (regex + parse_rub), bargain flag, publish_date (parse_ru_date),
  street address, photos (avatars.mds.yandex domain filter + size upgrade),
  newbuilding linkage (house_source='yandex_realty_nb' + house_ext_id)
- ScrapedLot mapping: lat/lon=None (no coords on SERP — geocode-missing
  fills later), listing_segment="vtorichka"
- Pagination: fetch_around_multi_room -> up to MAX_PAGES=3 pages, dedup by
  source_id. **kwargs swallow keeps old rooms/sort/pages callers compat.
- Preserved: BaseScraper interface, name="yandex" (matches existing rows +
  avoids breaking dedup_hash; Wave 5 conflict resolution can alias if needed),
  request_delay_sec=5.0, sleep_between_requests, tenacity retry.

Tests: 10 unit tests against hand-crafted fixture HTML (single card / studio /
no-price / empty page / multi-card / URL builder / city override) — all pass.
Ruff clean.
2026-05-23 16:21:47 +03:00