#!/usr/bin/env python3
"""Tampilkan konteks di sekitar nomor WhatsApp pada halaman tertentu (untuk tahu letaknya)."""
import re, sys, urllib.request

UA = {"User-Agent": "Mozilla/5.0"}
URL = sys.argv[1] if len(sys.argv) > 1 else "https://www.theskincodeclinic.com/"
NOMOR = sys.argv[2:] or ["6281335114324", "6285117444417"]
t = urllib.request.urlopen(urllib.request.Request(URL, headers=UA), timeout=90).read().decode("utf-8", "replace")
print(f"halaman: {URL} ({len(t)} char)")
for n in NOMOR:
    print(f"\n=== nomor {n} ===")
    ada = False
    for m in re.finditer(re.escape(n), t):
        ada = True
        awal = max(0, m.start() - 160)
        potong = re.sub(r"\s+", " ", t[awal:m.end() + 120])
        print(f"   ...{potong}")
    if not ada:
        print("   tidak ditemukan")
