#!/usr/bin/env python3
"""Verifikasi baca-balik carousel feed IG SS slot 08:30 WIB 8 Okt 2026 (read-only)."""
import re
from repliz_client import ReplizClient, ACC

c = ReplizClient()
scheds = []
page = 1
while True:
    r = c.get_schedules(page=page, limit=100)
    docs = (r or {}).get("docs") or (r or {}).get("data") or []
    if not docs:
        break
    scheds += docs
    if len(docs) < 100:
        break
    page += 1

print("total jadwal:", len(scheds))
target = None
for s in scheds:
    if s.get("accountId") != ACC.STUDIOSOFT_IG:
        continue
    at = s.get("scheduleAt", "") or ""
    if at.startswith("2026-10-08T01:30"):
        target = s
        break

if not target:
    print("TIDAK DITEMUKAN album di slot 2026-10-08T01:30Z")
else:
    print("id        :", target.get("_id") or target.get("id"))
    print("status    :", target.get("status"))
    print("scheduleAt:", target.get("scheduleAt"))
    print("type      :", target.get("type"))
    print("topic     :", target.get("topic"))
    print("title     :", target.get("title"))
    print("acc name  :", (target.get("account") or {}).get("name"))
    meds = target.get("medias") or []
    print("medias    :", len(meds))
    for m in meds:
        print("   ", m.get("url"))
    desc = target.get("description") or ""
    print("caption len:", len(desc))
    print("has link  :", "studiosoft.id" in desc)
    print("CTA ok    :", bool(re.search(r"komentar|diskusi|pendapat|tulis di|menurut anda", desc, re.I)))
    cjk = re.findall(r"[\u3000-\u9fff\uac00-\ud7af\u3040-\u30ff]", desc)
    print("CJK       :", cjk if cjk else "0")
    tags = re.findall(r"#(\w+)", desc)
    print("hashtags  :", tags)
    print("big tags  :", [t for t in tags if t != t.lower()])
    print("replies   :", len(target.get("replies") or []))
    print("--- caption ---")
    print(desc)
