Live dashboard: hilux.azmi.my
Apa Benda Ni
Aku bina web scraper yang kumpul listing Toyota Hilux dari Mudah.my setiap hari, simpan dalam AWS, dan papar dalam dashboard dengan charts dan filters. Automated — tak perlu buat manual.
Tech Stack
- Terraform — IaC untuk semua AWS resources
- Lambda — serverless scraper, bayar ikut guna
- DynamoDB — simpan data kereta
- S3 — archive dan host frontend
- AppSync (GraphQL) — API antara frontend dan DB
- CloudFront — CDN untuk serve site laju
- Python — Selenium + BeautifulSoup untuk scraping
Cabaran
1. Cloudflare Block
Mudah.my guna Cloudflare — detect bot dan block. Scraper aku kena loop infiniti.
Fix: Set realistic User-Agent, inject stealth JS, smart detection logic (only detect actual challenge page, bukan sekadar “cloudflare” text), dan refresh setiap 6 saat instead of setiap saat.
2. Mileage Extraction
Mileage tak consistent — kadang dalam description, kadang dalam detail section, kadang takde. Format pun beza: “42,000 km”, “42k km”, “42000 km”.
Fix: Multi-strategy approach — try detail page dulu, then description text, then specific HTML elements, then fallback ke section text. Semua convert ke format standard (number only).
3. Data Format (DynamoDB + AppSync)
Field keluar null, string literal instead of actual value, number format salah.
Fix: Validate sebelum simpan, handle null dengan default values, manually map setiap field dalam AppSync resolver dari DynamoDB format ke GraphQL format.
4. Frontend Display
Price regex hanya extract first digit (“48” dari “RM 48,000”). Mileage categories wording redundant. Date tak user-friendly.
Fix: Better regex untuk capture full price, clean mileage categories (“Tinggi — Perlu semakan”), human-readable dates (“2 hari lalu”).
Result
- Auto scrape daily — handle Cloudflare challenges
- Dashboard dengan price/mileage/age distribution charts
- Filter by location, year, price range
- Mobile responsive
- Social sharing per listing
Kos & Effort
- Kos: ~RM12-15/bulan (mostly DynamoDB + Lambda)
- Build time: ~2-3 minggu (part-time)
- Code: ~3000+ lines
Kalau korang nak tengok live: hilux.azmi.my