#!/usr/bin/env python3
"""Ambil dokumentasi Google Ads soal cara mengunduh data Keyword Planner (untuk memastikan langkahnya akurat)."""
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 = [
    "https://r.jina.ai/https://support.google.com/google-ads/answer/7337243",
    "https://r.jina.ai/https://support.google.com/google-ads/answer/6325025",
]
for u in URLS:
    try:
        h = urllib.request.urlopen(urllib.request.Request(u, headers=UA), timeout=90).read().decode("utf-8", "replace")
        print(f"\n=== {u.split('https://support.google.com/')[1][:60]} ({len(h)} char) ===")
        for baris in h.splitlines():
            if re.search(r"download|csv|unduh|keyword planner|perencana kata kunci|discover new|search volume|icon", baris, re.I) and len(baris) < 400:
                print("   ", baris.strip()[:190])
    except Exception as e:
        print(f"   gagal {u[:60]}: {str(e)[:60]}")
