#!/usr/bin/env python3
"""Cek nomor WhatsApp pada beberapa halaman TSC (artikel + halaman layanan)."""
import re, urllib.request

UA = {"User-Agent": "Mozilla/5.0"}
URLS = [
    "https://www.theskincodeclinic.com/dokter-kulit-sidoarjo-kapan-konsultasi/",
    "https://www.theskincodeclinic.com/faq-dokter-kulit-krian/",
    "https://www.theskincodeclinic.com/microneedling-dermapen-bekas-jerawat-krian/",
    "https://www.theskincodeclinic.com/perawatan-bekas-jerawat-krian/",
    "https://www.theskincodeclinic.com/",
]
for u in URLS:
    try:
        t = urllib.request.urlopen(urllib.request.Request(u, headers=UA), timeout=60).read().decode("utf-8", "replace")
    except Exception as e:
        print(f"   GAGAL {u[:60]} {str(e)[:40]}")
        continue
    wa = sorted(set(re.findall(r"wa\.me/(\d+)", t)))
    api = sorted(set(re.findall(r"phone=%?2?0?(\d{9,15})", t)))
    tel = sorted(set(re.findall(r"tel:\+?(\d[\d\- ]{7,})", t)))
    print(f"   {u.replace('https://www.theskincodeclinic.com', '') or '/'}")
    print(f"      wa.me: {wa} | api.whatsapp: {api} | tel: {tel}")
