#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Job #2690 (route 110 triage): freeze the two paper rows the matrix lacks. The triage's per-source table needs, for each source, the exact statement it makes. Two of the five rows read earlier (Maynard I 2006.06572v2, Maynard II 2006.07088v1, Lichtman 2309.08522v1) have bodies on disk in evidence/papers/. This fetches the other two (Maynard III 2006.08250v1, Li 2602.20917v6) as abstract (arXiv API, authoritative) plus full text if the HTML/PDF channel answers, so no hypothesis is quoted from memory. A channel that refuses is recorded as such, never papered over: the route's own rule is that an unread body stops the row. """ import hashlib import json import os import re import sys import urllib.error import urllib.request sys.stdout.reconfigure(encoding="utf-8", errors="replace") RUN = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) OUT = os.path.join(RUN, "evidence", "papers") UA = {"User-Agent": "solveathome-twin-primes-research/1.0 (route 110 triage)"} IDS = ["2006.08250v1", "2602.20917v6"] def get(url, timeout=60): req = urllib.request.Request(url, headers=UA) with urllib.request.urlopen(req, timeout=timeout) as r: return r.status, r.read() def arxiv_api(ident): url = ("https://export.arxiv.org/api/query?id_list=" + ident) st, raw = get(url) t = raw.decode("utf-8", "replace") title = re.search(r".*?(.*?)", t, re.S) summ = re.search(r".*?(.*?)", t, re.S) return st, raw, { "title": " ".join(title.group(1).split()) if title else None, "abstract": " ".join(summ.group(1).split()) if summ else None, } def main(): os.makedirs(OUT, exist_ok=True) report = {"at": "2026-09-19", "transport": "urllib.request direct HTTPS GET", "rows": []} for ident in IDS: rec = {"id": ident} try: st, raw, parsed = arxiv_api(ident) ap = os.path.join(OUT, "api-%s.xml" % ident) with open(ap, "wb") as fh: fh.write(raw) rec.update({"api_status": st, "api_sha256": hashlib.sha256(raw).hexdigest(), "title": parsed["title"], "abstract_chars": len(parsed["abstract"] or ""), "abstract": parsed["abstract"]}) except Exception as e: rec["api_error"] = "%s: %s" % (type(e).__name__, e) # Full text: try the arXiv HTML rendering first (structure preserved, cheap), then laTeX source. for tag, url in (("html", "https://arxiv.org/abs/%s" % ident), ("e-print", "https://arxiv.org/e-print/%s" % ident)): try: st, raw = get(url) p = os.path.join(OUT, "%s.%s" % (ident, "html" if tag == "html" else "src")) with open(p, "wb") as fh: fh.write(raw) rec[tag] = {"status": st, "bytes": len(raw), "sha256": hashlib.sha256(raw).hexdigest(), "saved": os.path.relpath(p, RUN).replace("\\", "/")} break except Exception as e: rec[tag + "_error"] = "%s: %s" % (type(e).__name__, e) report["rows"].append(rec) print(json.dumps({k: v for k, v in rec.items() if k != "abstract"}, ensure_ascii=False)) with open(os.path.join(RUN, "artifacts", "fetch2690.json"), "w", encoding="utf-8", newline="\n") as fh: fh.write(json.dumps(report, ensure_ascii=False, indent=1) + "\n") return 0 if __name__ == "__main__": sys.exit(main())