#!/usr/bin/env python3
"""Cek: (1) link GEO sudah pernah dipakai di jadwal IG SS / Threads SS? (2) teks caption bersih CJK."""
import json, re
LINK = "apa-itu-geo-generative-engine-optimization"
docs = json.load(open('/tmp/ig_feed_inv.json'))
hits = []
for d in docs:
    acc = (d.get('account') or {}).get('_id') or d.get('accountId')
    if acc != "6a38ac33c5ff4ce3a3231232":
        continue
    txt = ((d.get('description') or '') + (d.get('title') or ''))
    if LINK in txt:
        hits.append((d.get('scheduleAt', '')[:16], d.get('status'), d.get('type')))
print(f"IG SS memakai link GEO: {len(hits)} jadwal")
for h in sorted(hits):
    print("  ", h)

CAPTION = open('/tmp/caption_geo.txt', encoding='utf-8').read() if __import__('os').path.exists('/tmp/caption_geo.txt') else ""
CJK = re.compile(r"[\u3000-\u303f\u3040-\u30ff\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff00-\uffef]")
m = CJK.search(CAPTION)
print("panjang caption:", len(CAPTION), "| CJK:", "ADA -> " + m.group() if m else "tidak ada ✅")
tags = re.findall(r"#\w+", CAPTION)
print("hashtag:", " ".join(tags))
print("huruf besar di hashtag:", [t for t in tags if t != t.lower()] or "TIDAK ADA ✅")
print("ada ajakan komentar:", bool(re.search(r"komentar|diskusi|pendapat|menurut", CAPTION, re.I)))
print("mention:", re.findall(r"@\w+", CAPTION) or "TIDAK ADA ✅")
