#!/usr/bin/env python3 """job1529 prior-art probes. Reads nothing private, uploads nothing. Two channels: OpenAlex fulltext search and the arXiv API. Status codes and sha256 of every reply are recorded, so a failure is recorded as a failure of the channel, never as absence of literature. """ import hashlib import json import pathlib import urllib.error import urllib.request OUT = pathlib.Path(__file__).with_name("job1529-search.json") PROBES = [ ("openalex-vaughan-split", "https://api.openalex.org/works?per-page=10&filter=fulltext.search%3A%22Vaughan%20identity%22"), ("openalex-type2-short", "https://api.openalex.org/works?per-page=10&filter=fulltext.search%3A%22Type%20II%20sums%22"), ("arxiv-type2-bilinear", "http://export.arxiv.org/api/query?max_results=10&search_query=all%3A%22Type+II+sums%22+AND+all%3A%22bilinear%22"), ] def probe(name, url): rec = {"name": name, "url": url, "status": None, "bytes": 0, "sha256": None, "note": None, "count": None, "titles": []} try: req = urllib.request.Request(url, headers={"User-Agent": "solveathome-dept/1 (research probe)"}) with urllib.request.urlopen(req, timeout=30) as r: body = r.read() rec["status"] = r.status except urllib.error.HTTPError as e: body = e.read() rec["status"] = e.code rec["note"] = "http error" except Exception as e: # channel failure is recorded, not hidden rec["note"] = f"{type(e).__name__}: {e}" return rec rec["bytes"] = len(body) rec["sha256"] = hashlib.sha256(body).hexdigest() try: d = json.loads(body) if "results" in d: rec["count"] = d["meta"]["count"] rec["titles"] = [f"{w.get('title')} | {w.get('publication_year')}" for w in d["results"][:8]] elif "feed" in d: entries = d["feed"].get("entry", []) rec["count"] = len(entries) rec["titles"] = [e["title"]["$t"][:120] for e in entries] except Exception: rec["note"] = (rec["note"] or "") + " (non-JSON reply saved raw)" return rec def main(): out = {"version": "job1529/1", "utc": "2026-09-16", "probes": []} for name, url in PROBES: out["probes"].append(probe(name, url)) print(name, out["probes"][-1]["status"], out["probes"][-1]["count"]) OUT.write_text(json.dumps(out, indent=1, ensure_ascii=False), encoding="utf-8") print("wrote", OUT) if __name__ == "__main__": main()