import json, re d = json.load(open("posts.json", encoding="utf-8")) ASK = re.compile(r"\b(looking for|seeking|hiring|need(?:s|ed)? (?:a|an|some|help)|anyone (?:know|have|recommend)|recommend|lf[a-z]?\b|commission(?:s)? (?:open|wanted)|paid (?:gig|work|commission)|budget|rev[- ]?share|\$\s?\d+|\d+\s?(?:usd|\$|€|eur)|where (?:do|can) (?:you|i) (?:get|find))", re.I) ART = re.compile(r"\b(pixel|sprite|tileset|tile set|asset|artist|art|animation|animator|portrait|character design|ui|icon|background)", re.I) c = [p for p in d["posts"] if ASK.search(p["text"]) and ART.search(p["text"]) and not p["bot"]] c.sort(key=lambda p: p["time"]) json.dump(c, open("candidates.json", "w", encoding="utf-8"), ensure_ascii=False, indent=1) print(len(c)) for i, p in enumerate(c): t = " ".join(p["text"].split())[:260] print(f"[{i}] {p['handle']} L{p['likes']} R{p['replies']}{' (reply)' if p['is_reply'] else ''}: {t}")