import json

with open(r"c:\Users\Daniil\VS_Code\Trash\mcp_classified.json", "r", encoding="utf-8") as f:
    items = json.load(f)

target_ids = [
    ("NN", 11417),
    ("Костыль", 3299),
    ("Эксплойт", 24373),
    ("NN", 11639),
    ("NN", 15722),
    ("Эксплойт", 32533),
    ("NN", 15485),
    ("Костыль", 6196),
    ("Абьюзер ChatGPT | 2.0", 378),
    ("NN", 17574),
    ("NN", 15541),
    ("AI для своих", 80),
    ("Абьюзер ChatGPT | 2.0", 249),
    ("Костыль", 3020),
    ("Костыль", 4919),
    ("NN", 18057),
    ("Эксплойт", 38004),
    ("Костыль", 5622),
    ("NN", 14565)
]

with open(r"c:\Users\Daniil\VS_Code\Trash\top_mcp_posts_full.txt", "w", encoding="utf-8") as out:
    for ch, mid in target_ids:
        for it in items:
            p = it["post"]
            if p["channel"] == ch and p["message_id"] == mid:
                out.write(f"=== {ch} | ID: {mid} | Date: {p['date']} ===\n")
                out.write(f"Post link: {p['post_link']}\n")
                out.write(f"URL entities: {p['links']}\n")
                out.write("Text:\n" + p["text"] + "\n")
                out.write("\n" + "="*50 + "\n\n")
                break

print("Written top_mcp_posts_full.txt")
