fix(tradein): decode Avito houses URL-encoded __preloadedState__ (#566) #618
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#618
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/tradein-avito-houses-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Avito сменил формат SSR state-блоба houses-каталога → парсер молча перестал наполнять houses (starve'ит #6 same-building + #569 deal-центроиды). Воркер снял живой fixture (curl_cffi chrome120, не заблокирован) и пофиксил 3 ломающих изменения:
__preloadedState__теперь URL-encoded литерал (был JSON.parse js-escaped) → urllib.parse.unquote + json.loadsDecode вынесен в pure _extract_preloaded_state (fallback на старую форму), _flatten_widgets, tolerant _parse_house_page.
Tests
Real-HTML fixture (Yumasheva-6 EKB) + 4 regression → 22 passed. Ruff clean. code-reviewer APPROVE (regex anchoring, decode safety no-eval, backward-compat, delisted-house graceful, fixture без PII).
Deploy
Миграций нет. После merge cron-sweep снова наполняет houses. Public API не изменился.
Closes #566.
Avito switched the houses-catalog state blob from JSON.parse("<js-escaped>") to a URL-encoded string literal, wrapped the 10 widgets in placeholders[0].widgets, и re-nested developmentData под props.housePage. JS-unescape path silently failed → houses rows перестали наполняться (starve'ит #6 same-building + #569 deal centroids). Extract decode в pure _extract_preloaded_state (urllib.parse.unquote, JSON.parse fallback для старой формы), add _flatten_widgets, и сделать _parse_house_page tolerant к обеим developmentData/ratingPreview формам. Real-HTML fixture (Yumasheva-6 EKB) + 4 regression-теста. code-reviewer: ✅ APPROVE no critical (regex anchoring verified, decode safe — no eval/unicode_escape, backward-compat реальный, delisted-house envelope degrade'ит gracefully, fixture без PII/secrets). Tests: 22 passed. Closes #566