#!/usr/bin/env python3
"""hc60: cek antrean LinkedIn SS vs artikel terbaru (untuk pilih artikel LI)."""
import json, re, sys
sys.path.insert(0, "/home/mantapman/.hermes/profiles/atun/workspace")
from repliz_client import ACC

docs = json.load(open("/tmp/repliz_all_20261008.json"))
url_re = re.compile(r"studiosoft\.id/([a-z0-9\-]+)")
li = set()
for d in docs:
    if d.get("accountId") == ACC.STUDIOSOFT_LINKEDIN and (d.get("status") or "").lower() in ("pending", "scheduled", "draft"):
        li |= set(url_re.findall((d.get("description") or "") + " " + (d.get("title") or "")))
print("LI queue slugs (%d):" % len(li))
for s in sorted(li):
    print("  ", s)
print()
posts = json.load(open("/tmp/ss_posts_30.json"))
print("Artikel terbaru vs LI queue:")
for p in posts[:14]:
    s = p["slug"]
    print("  %-10s id=%-6s %-70s LIqueue=%s" % (p["date"][:10], p.get("id"), s[:70], s in li))
