← back to Rentv Sheet Enrich
LOCAL $0 pipeline: openclaw company-LinkedIn (local_li.py) + continuous runner (run_local.sh); replaces rate-limited Exa
9983125c69d24427bd3ec513f943a9ddd35b02f1 · 2026-08-13 11:27:57 -0700 · Steve Abrams
Files touched
A local_li.pyA run_local.sh
Diff
commit 9983125c69d24427bd3ec513f943a9ddd35b02f1
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Thu Aug 13 11:27:57 2026 -0700
LOCAL $0 pipeline: openclaw company-LinkedIn (local_li.py) + continuous runner (run_local.sh); replaces rate-limited Exa
---
local_li.py | 41 +++++++++++++++++++++++++++++++++++++++++
run_local.sh | 18 ++++++++++++++++++
2 files changed, 59 insertions(+)
diff --git a/local_li.py b/local_li.py
new file mode 100644
index 0000000..2c4aace
--- /dev/null
+++ b/local_li.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python3
+"""
+local_li.py <batchfile.json> — $0 LOCAL company-LinkedIn via openclaw real browser.
+
+For each company in the batch, drives the proven openclaw LinkedIn finder
+(la-socrata-ingester/scripts/linkedin-openclaw.js --name=...), parses the real
+linkedin.com/company/... href it returns, and writes it to the master's
+LinkedIn (Company) column via write_by_name.py. TRUTHFUL by construction — we only
+accept a URL openclaw actually rendered from a live Google result (no LLM guessing).
+"""
+import sys, os, json, re, subprocess
+OC = os.path.expanduser("~/Projects/la-socrata-ingester/scripts/linkedin-openclaw.js")
+
+def company_li(name):
+ try:
+ out = subprocess.run(["node", OC, f"--name={name}"], cwd=os.path.dirname(OC),
+ capture_output=True, text=True, timeout=75).stdout
+ except Exception:
+ return ""
+ # tool prints "→ <Company>: https://www.linkedin.com/company/<slug>"
+ m = re.search(r'https?://(?:www\.)?linkedin\.com/company/[A-Za-z0-9\-_%]+', out)
+ return m.group(0) if m else ""
+
+def main():
+ batch = json.load(open(sys.argv[1]))
+ gid = batch["gid"]; targets = batch["targets"]
+ res = []
+ for t in targets:
+ comp = t["company"]
+ li = company_li(comp)
+ print(f" {comp[:34]:34s} -> {li or '(none)'}", flush=True)
+ if li:
+ res.append({"company": comp, "company_li": li})
+ out = sys.argv[1].replace(".json", "_li.json")
+ json.dump(res, open(out, "w"))
+ print(f"{len(res)}/{len(targets)} company LinkedIn found -> {out}", flush=True)
+ if res:
+ subprocess.run(["python3", os.path.join(os.path.dirname(__file__),"write_by_name.py"), str(gid), out])
+
+if __name__ == "__main__":
+ main()
diff --git a/run_local.sh b/run_local.sh
new file mode 100755
index 0000000..8d2be05
--- /dev/null
+++ b/run_local.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+# Continuous $0 LOCAL enrichment: openclaw company-LinkedIn across all remaining master
+# batches, propagating to all tabs every 5 batches. No rate limit. Logs to run_local.log.
+cd ~/Projects/rentv-sheet-enrich
+n=0
+for f in data/mbatches/m_*.json; do
+ [ "$f" = "data/mbatches/m_01.json" ] && continue
+ echo "=== $(basename $f) $(date +%H:%M:%S) ===" >> run_local.log
+ python3 local_li.py "$f" >> run_local.log 2>&1
+ n=$((n+1))
+ if [ $((n % 5)) -eq 0 ]; then
+ echo "--- propagate (after $n batches) ---" >> run_local.log
+ python3 propagate.py >> run_local.log 2>&1
+ fi
+done
+echo "--- final propagate ---" >> run_local.log
+python3 propagate.py >> run_local.log 2>&1
+echo "ALL LOCAL BATCHES DONE $(date +%H:%M:%S)" >> run_local.log
← e30cac5 propagate to Sheet2 venues (7317) + Locations; all company/v
·
back to Rentv Sheet Enrich
·
auto-data-snapshot: 2026-08-13T11:55:54 (59 data files) — VP 4f042f7 →