#!/usr/bin/env python3
"""Tampilkan blok lengkap tempat nomor salah berada di beranda TSC + heading terdekat."""
import re, urllib.request

UA = {"User-Agent": "Mozilla/5.0"}
URL = "https://www.theskincodeclinic.com/"
N = "6281335114324"
t = urllib.request.urlopen(urllib.request.Request(URL, headers=UA), timeout=90).read().decode("utf-8", "replace")
i = t.find(N)
print(f"posisi karakter: {i} dari {len(t)}")

# heading terdekat sebelum tombol
sebelum = t[:i]
head = re.findall(r"<h[1-4][^>]*>(.*?)</h[1-4]>", sebelum, re.S)
print(f"heading terdekat sebelum tombol: {re.sub(r'<[^>]+>|\\s+', ' ', head[-1]).strip()[:120] if head else '-'}")
blok = re.sub(r"\s+", " ", t[max(0, i - 700):i + 260])
print("\nblok sekitar tombol:\n" + blok)
