Fix match detail: add endpoint + parallel scrape

#9

Fix: Match detail endpoint missing + slow loading

Root Cause

  1. Endpoint /api/match/{event_id}/detail did not exist in main.py → returned 404 → frontend showed "Không thể tải dữ liệu" → hanging on click
  2. match_detail_v2.py had complete parser but was never imported/registered in main.py
  3. Sequential scraping was very slow: tried /centre/ → fail → /preview/ → fail → /bao-cao-nhanh/ → each with 15s timeout = up to 45s per request

Changes

  • main.py: Added /api/match/{event_id}/detail endpoint that calls fetch_match_detail() / fetch_match_detail_by_url() from match_detail_v2.py
  • match_detail_v2.py: Parallel URL scraping (3 workers, 8s timeout each, 12s total max) instead of sequential
  • match_detail_v2.py: Reduced h2h-stats API timeout from 10s to 6s
  • static/match_detail_v6.js: Reduced frontend fetch timeout from 25s to 15s

Files Changed

  • main.py: +12 lines (import + endpoint)
  • match_detail_v2.py: parallel scraping, reduced timeouts
  • static/match_detail_v6.js: timeout 25s → 15s
bep40 changed pull request status to open
bep40 changed pull request status to merged

Sign up or log in to comment