#!/usr/bin/env python3
"""TSLaw: verifikasi judul & meta di halaman live (bukan cuma dari Yoast)."""
import re, urllib.request

UA = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/124 Safari/537.36"}
for u in ("/tentang/", "/practice-areas/", "/hubungi/", "/artikel/", "/sample-page/", "/"):
    try:
        r = urllib.request.urlopen(urllib.request.Request(f"https://www.tslaw.id{u}", headers=UA), timeout=60)
        h = r.read().decode("utf-8", "replace")
        t = re.search(r"<title>(.*?)</title>", h, re.S)
        d = re.search(r'<meta name="description" content="([^"]*)"', h)
        print(f"  {r.status} | {u:<18} judul: {t.group(1)[:62] if t else '-'}")
        print(f"        meta: {(len(d.group(1)) if d else 0)} char")
    except urllib.error.HTTPError as e:
        print(f"  {e.code} | {u}")
    except Exception as e:
        print(f"  ERR {str(e)[:40]} | {u}")
