#!/usr/bin/env python3
"""Cek panduan resmi Google soal heading/H1 supaya jawabannya berdasar dokumen, bukan ingatan."""
import re, urllib.request

UA = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/124 Safari/537.36"}
URLS = [
    ("SEO Starter Guide", "https://r.jina.ai/https://developers.google.com/search/docs/fundamentals/seo-starter-guide"),
    ("Search Essentials", "https://r.jina.ai/https://developers.google.com/search/docs/essentials"),
]
for nama, u in URLS:
    try:
        t = urllib.request.urlopen(urllib.request.Request(u, headers=UA), timeout=90).read().decode("utf-8", "replace")
        print(f"\n=== {nama} ===")
        for m in re.finditer(r"[^.\n]{0,220}heading[^.\n]{0,220}", t, re.I):
            baris = " ".join(m.group(0).split())
            if len(baris) > 40:
                print("   •", baris[:300])
    except Exception as e:
        print(f"   {nama}: gagal {str(e)[:70]}")
