mirror of
https://github.com/nethunterzist/trendyol-analiz
synced 2026-08-30 05:48:00 +00:00
fix(scraper): best seller siralamasi, tekrar eden urunler ve sosyal kanit bugu duzeltildi
Ne yaptik: - scraper.py fetch_page: "sst": "BEST_SELLER" parametresi eklendi - scraper.py fetch_page: "countryCode": "TR" parametresi eklendi - scraper.py _normalize_search_product: socialProof (TEKIL) alanindan okunuyor, eski cogul socialProofs fallback olarak birakildi - main.py _find_leaves: pathModel artik "<slug>-x-c<categoryId>" formatinda uretiliyor (queue_worker.py ile ayni mantik) Neden yaptik: - Trendyol Search API siralama parametresi verilmezse sayfalar arasi tutarsiz sonuc donuyordu: 240 urunluk cekimde sadece 134 benzersiz urun geliyordu, yani raporlarin %44'u ayni urunun tekrariydi. sst=BEST_SELLER ile tekrar tamamen sifirlandi (240/240 benzersiz) - Sosyal kanit alani API'de TEKIL "socialProof" olarak geliyor ama kod cogul "socialProofs" diye okuyordu; bu yuzden satis/favori verisi hep bos donuyordu. Telafi icin cagrilan Top Rankings API ise Trendyol tarafinda kaldirildigi icin 404 veriyor (K8s loglarinda dogrulandi). Duzeltmeden sonra 238/240 uruna orderCount ve favoriteCount geliyor - countryCode zorunlu hale gelmis; yoksa API 400 "Required country information" donuyor - main.py salt slug gonderiyordu (or. "yuz-kremi"), API 0 urun donuyordu. Dogru format "yuz-kremi-x-c1122" Test: - yuz-kremi-x-c1122, 10 sayfa: 240 urun / 240 benzersiz / 0 tekrar / 238 sosyal kanit - Regresyon: 6 farkli kategori tipinde 6/6 basarili, tekrar yok Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1694,7 +1694,10 @@ async def create_report(
|
||||
# This is a leaf — return itself
|
||||
cat = tree_by_id.get(parent_id)
|
||||
if cat:
|
||||
path_model = (cat.get("url") or "").lstrip("/") or None
|
||||
# Trendyol pathModel formati: "<slug>-x-c<categoryId>" (or. yuz-kremi-x-c1122).
|
||||
# Salt slug gonderilirse API 0 urun donuyor. queue_worker.py ile ayni mantik.
|
||||
url_slug = (cat.get("url") or "").lstrip("/")
|
||||
path_model = f"{url_slug}-x-c{cat['id']}" if url_slug else None
|
||||
return [(path_model, cat["name"], cat["id"])]
|
||||
return []
|
||||
leaves = []
|
||||
|
||||
Reference in New Issue
Block a user