lekss361
|
23f89d1935
|
feat(tradein): yandex_helpers.py — shared parsing utilities + tests
Foundation helpers for YandexRealtyScraper v1 Stages 3-6:
- JSON-LD extraction (extract_json_ld, find_ld_by_type) — Product/Offer/BreadcrumbList
- Regex constants (RE_OFFER_ID, RE_JK_ID, RE_TITLE_AREA, RE_TITLE_ROOMS, RE_FLOOR,
RE_PRICE, RE_PPM2, RE_VIEWS, RE_METRO_WALK, RE_YEAR, RE_AGENCY_*)
- Russian date parsers (parse_ru_date "9 мая 2026" + parse_dmy "17.02.2026")
- NLP helpers (parse_house_type → panel/monolith/brick/block/wood;
parse_house_class → elite/premium/business/comfort_plus/comfort/economy)
- Money parser (parse_rub: "4 399 000 ₽" / "4,4 млн ₽" / "117500" / None)
Spec fixes: RE_TITLE_ROOMS split into two alternations to handle standalone
"Студия" (group 2) vs "N-комнатная" (group 1); parse_house_class premium
pattern extended to cover reversed word order "премиум-класса".
Test coverage: 36 unit tests across all helpers (uv run pytest passes,
ruff check clean).
|
2026-05-23 16:07:02 +03:00 |
|