domainhunter-panel/export_latest_domains.py
Adrian Miesikowski df0f0515a0
Some checks are pending
CI / lint (push) Waiting to run
Deploy / deploy (push) Waiting to run
feat: add OpenClaw LLM scoring pipeline for all domains and surface in panel
2026-02-17 23:55:48 +01:00

24 lines
917 B
Python
Executable File

#!/usr/bin/env python3
import json
import sqlite3
from pathlib import Path
BASE = Path(__file__).resolve().parent
DB = BASE / 'data' / 'domainhunter.db'
con = sqlite3.connect(DB)
cur = con.cursor()
run_id = cur.execute("SELECT value FROM metadata WHERE key='latest_run_id'").fetchone()
run_id = run_id[0] if run_id else ''
scanned = cur.execute("SELECT value FROM metadata WHERE key='latest_scanned_at'").fetchone()
scanned = scanned[0] if scanned else ''
rows = cur.execute("SELECT domain,tld,score,status,keywords_json FROM domains WHERE run_id=? ORDER BY score DESC,domain ASC", (run_id,)).fetchall()
items=[]
for d,tld,score,status,kw in rows:
try:
kws=json.loads(kw or '[]')
except Exception:
kws=[]
items.append({"domain":d,"tld":tld,"score":score,"status":status,"keywords":kws})
print(json.dumps({"runId":run_id,"scannedAt":scanned,"items":items}, ensure_ascii=False, indent=2))