| 1046 | if not plugins: |
| 1047 | print("[!] No plugins loaded.") |
| 1048 | return |
| 1049 | out = run_plugins(plugins, data) |
| 1050 | save_json(f"plugins_out_{int(time.time())}.json", out) |
| 1051 | print("[*] Plugins run complete. Saved output.") |
| 1052 | |
| 1053 | |
| 1054 | def cmd_export(args): |
| 1055 | path = args.file or input("Path to JSON results file (default last crawl JSON): ").strip() |
| 1056 | if not path: |
| 1057 | files = [f for f in os.listdir(RESULTS_DIR) if f.startswith("crawl_") and f.endswith(".json")] |
| 1058 | files = sorted(files, key=lambda x: os.path.getmtime(os.path.join(RESULTS_DIR, x)), reverse=True) |
| 1059 | if not files: |
| 1060 | print("[!] No result files found.") |
| 1061 | return |
| 1062 | path = os.path.join(RESULTS_DIR, files[0]) |
| 1063 | if not os.path.isfile(path): |
| 1064 | print("[!] File not found:", path) |
| 1065 | return |
| 1066 | try: |
| 1067 | with open(path, "r", encoding="utf-8") as f: |
| 1068 | data = json.load(f) |
| 1069 | except Exception as e: |
| 1070 | print("[!] Failed to load JSON:", e) |
| 1071 | return |