feat(lps): 오픈마켓 폴백 오케스트레이션 + 몰 dedup
사용자 규칙 '네이버로 그 몰 값 확보 성공→그 값, 실패(몰 없음)→실사이트 크롤' 구현. - handler: found 라운드 뒤 _enrich_with_fallback — 네이버 매칭이 커버 못 한 타깃 몰만 (canonical_mall 로 판정) 크롤 어댑터로 검색→같은상품 판정→병합. 크롤 실패는 격리(무시). fallback_crawl STAGE 기록. - summarize_by_mall: 키를 (source,mall)→몰명(canonical)으로 — 네이버노출 vs 직접크롤 같은 몰 중복을 최저가 1건으로 병합(dedup). - card_parser: MALL_BY_SOURCE + canonical_mall() 추가. - worker_main: gmarket/auction/st11 폴백 어댑터 등록(lazy 기동, 리소스차단 OFF). - 테스트: 커버몰 크롤생략·미커버 크롤·실패격리·몰 dedup 4종. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e365e5c6e0
commit
f9714c3f06
5 files changed
+108
-11
No files matched your search
@@ -52,13 +52,13 @@ def apply_filters(
|
||||
|
||||
|
||||
def summarize_by_mall(products: list[NormalizedProduct]) -> list[dict]:
|
||||
"""같은상품 매칭 후보를 (소스, 판매몰)별 최저가로 분해한다.
|
||||
네이버 결과엔 G마켓·옥션·11번가 등이 mall_name 으로 이미 들어오므로,
|
||||
추가 요청 없이 '오픈마켓 몰별 최저가'를 노출할 수 있다(가격 오름차순).
|
||||
네이버 가격비교(mall_name='네이버')는 여러 판매자 중 최저가 롤업이다."""
|
||||
best: dict[tuple[str, str], NormalizedProduct] = {}
|
||||
"""같은상품 매칭 후보를 판매몰별 최저가로 분해한다(가격 오름차순).
|
||||
네이버 결과엔 G마켓·옥션·11번가 등이 mall_name 으로 이미 들어오고, 크롤 폴백도 같은 몰명을 쓴다.
|
||||
**몰명(canonical)으로 dedup** — 같은 몰이 네이버 노출과 직접 크롤 양쪽에서 와도 최저가 1건으로 병합
|
||||
(네이버 가격비교 mall_name='네이버'는 여러 판매자 최저가 롤업이라 별도 몰로 취급)."""
|
||||
best: dict[str, NormalizedProduct] = {}
|
||||
for p in products:
|
||||
key = (p.source, (p.mall_name or "기타"))
|
||||
key = p.mall_name or p.source or "기타" # 몰 정체성 = 몰명(소스 무관 병합)
|
||||
cur = best.get(key)
|
||||
if cur is None or p.price < cur.price:
|
||||
best[key] = p
|
||||
|
||||
Reference in new issue
Block a user