autoreg-skills-max: initial public release (restored, redacted, hardened)
This commit is contained in:
22
skills/telegram-mass-join/scripts/merge_joined.py
Normal file
22
skills/telegram-mass-join/scripts/merge_joined.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""Merge per-process joined_chats files into one.
|
||||
Usage: python merge_joined.py
|
||||
Loads joined_chats_1.json, _2, _3 (and base), deduplicates by username/id, writes joined_chats.json.
|
||||
"""
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(r"C:\Users\User\Desktop\_PROJECTS\рассылка")
|
||||
merged = {}
|
||||
for suffix in ["", "_1", "_2", "_3"]:
|
||||
p = ROOT / f"joined_chats{suffix}.json"
|
||||
if p.exists():
|
||||
data = json.load(open(p, encoding="utf-8"))
|
||||
before = len(merged)
|
||||
for k, v in data.items():
|
||||
if k not in merged:
|
||||
merged[k] = v
|
||||
print(f"{p.name}: {len(data)} chats, {len(merged) - before} new")
|
||||
|
||||
out = ROOT / "joined_chats.json"
|
||||
json.dump(merged, open(out, "w"), ensure_ascii=False)
|
||||
print(f"\nMerged: {len(merged)} unique chats -> joined_chats.json")
|
||||
Reference in New Issue
Block a user