Spaces:
Building
Building
Fix match detail: add endpoint + parallel scrape
#9
by bep40 - opened
Fix: Match detail endpoint missing + slow loading
Root Cause
- Endpoint
/api/match/{event_id}/detaildid not exist in main.py → returned 404 → frontend showed "Không thể tải dữ liệu" → hanging on click match_detail_v2.pyhad complete parser but was never imported/registered in main.py- 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}/detailendpoint that callsfetch_match_detail()/fetch_match_detail_by_url()frommatch_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 timeoutsstatic/match_detail_v6.js: timeout 25s → 15s
bep40 changed pull request status to open
bep40 changed pull request status to merged