#!/usr/bin/env python3 """job #1503 prior-art probe: does a published *convolution-type* Bombieri-Vinogradov statement admit a FIXED SHIFT in the second factor? (The route's decisive question.) Channels: arXiv API (metadata + abstract) and Semantic Scholar (bibliographic record). Read-only HTTP; only the reachable, previously calibrated channels are used. """ import json import os import urllib.parse import urllib.request OUT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "sources") os.makedirs(OUT, exist_ok=True) UA = {"User-Agent": "sah-department-research/1 (job 1503; contact via solveathome)"} def get(url, name): req = urllib.request.Request(url, headers=UA) with urllib.request.urlopen(req, timeout=30) as r: body = r.read() with open(os.path.join(OUT, name), "wb") as f: f.write(body) print(f"# GET {url}\n# -> {len(body)} bytes, saved {name}") return body.decode("utf-8", "replace") def arxiv(query, name, max_results=20): url = ("http://export.arxiv.org/api/query?search_query=" + urllib.parse.quote(query) + f"&max_results={max_results}") return get(url, name) def entries(xml): out = [] for chunk in xml.split("")[1:]: def field(tag, src=chunk): i = src.find(f"<{tag}>") j = src.find(f"") return src[i + len(tag) + 2:j].strip() if i >= 0 and j >= 0 else "" out.append({ "id": field("id"), "title": " ".join(field("title").split()), "published": field("published")[:10], "updated": field("updated")[:10], "authors": [c.split("")[1].split("")[0] for c in chunk.split("")[1:]], "categories": [c.split('term="')[1].split('"')[0] for c in chunk.split(" {len(es)} entries") for e in es[:8]: print(f" - {e['published']} {e['id'].split('/abs/')[-1]} {e['title']}") print(f" cats={e['categories'][:3]} comment={e['comment'][:120]}") print(f" {e['summary'][:600]}") print("\n== channel 2: Semantic Scholar (Darbar-Mukhopadhyay, nearest prior work of #1502) ==") try: s = get("https://api.semanticscholar.org/graph/v1/paper/search" "?query=Darbar%20Mukhopadhyay%20Bombieri-Vinogradov%20imaginary%20quadratic" "&fields=title,authors,year,venue,externalIds,abstract&limit=5", "s2-darbar-mukhopadhyay.json") print(json.dumps(json.loads(s), indent=1)[:2500]) except Exception as exc: # record the failure, never fabricate print(f"# S2 channel failed: {type(exc).__name__}: {exc}")