Does light charge the quons? › Files cited on the page › check_earnshaw_pages_fable/

parse_search.py

In the investigation at sim/charge_wave/check_earnshaw_pages_fable/parse_search.py · last changed in commit 08d8d68, 13 November 2026 · 1,795 bytes · the folder as a zip


"""Ninth review: list the result links of the site's own search pages (fetched as search_*.html), and compare with
the sixteen slugs in sources/aspden_earnshaw_2026-11-13/pages.tsv. Run: python3 -I parse_search.py <fetched dir> <pages.tsv>"""
import os, re, sys, html
D, TSV = sys.argv[1:3]
known = set(l.split("\t")[0] for l in open(TSV, encoding="utf-8").read().splitlines()[1:])
allres = {}
for f in sorted(os.listdir(D)):
    if not f.startswith("search_"):
        continue
    raw = open(os.path.join(D, f), encoding="utf-8", errors="replace").read()
    res = re.findall(r'(?is)<h2 class="wp-block-post-title has-x-large-font-size"[^>]*>\s*<a[^>]+href="([^"]+)"[^>]*>(.*?)</a>', raw)
    nxt = re.search(r'(?is)<a[^>]+href="([^"]+)"[^>]*class="[^"]*wp-block-query-pagination-next[^"]*"', raw) or re.search(r'(?is)class="[^"]*wp-block-query-pagination-next[^"]*"[^>]*href="([^"]+)"', raw)
    nf = re.search(r"(?is)wp-block-query-no-results[^>]*>(.*?)</div>", raw)
    print(f"-- {f}: {len(res)} result(s); next: {nxt.group(1) if nxt else 'none'}; no-results block: {re.sub('<[^>]+>', ' ', nf.group(1)).strip()[:60] if nf else '-'}")
    for href, lab in res:
        slug = href.rstrip("/").split("/")[-1]
        lab = html.unescape(re.sub(r"<[^>]+>", " ", lab)).strip()
        allres.setdefault(slug, (href, lab, f.split("_")[1]))
        print(f"     {slug:55s} {lab[:60]}")
print("\n== Result slugs for 'Earnshaw' not among the sixteen of pages.tsv:")
for slug, (href, lab, q) in sorted(allres.items()):
    if q == "earnshaw" and slug not in known:
        print(f"   {slug:55s} {lab[:70]}")
print("\n== The sixteen of pages.tsv not returned by the 'Earnshaw' search:")
got = set(s for s, v in allres.items() if v[2] == "earnshaw")
for s in sorted(known - got):
    print("   ", s)