back to table · edit · history · where entries came from · files · download
2893 bytes, as of the version from 2026-11-26 12:13 (current). Recorded here, not run.
import os,sys,json
from pathlib import Path
from urllib.parse import urlsplit
from playwright.sync_api import sync_playwright
W=Path(os.environ['NUMBERDB_WORKDIR']);key=sys.stdin.read().strip()
if '=' in key:key=key.split('=',1)[1].strip().strip('\"\'')
with sync_playwright() as p:
browser=p.chromium.launch(headless=True,args=['--no-sandbox'])
context=browser.new_context(viewport={'width':1440,'height':1050},device_scale_factor=1)
def authorize(route):
headers=dict(route.request.headers)
if urlsplit(route.request.url).hostname=='numberdb.org':headers['Authorization']='Bearer '+key
route.continue_(headers=headers)
context.route('**/*',authorize)
page=context.new_page();errors=[]
page.on('pageerror',lambda e:errors.append(str(e)))
response=page.goto('https://numberdb.org/T819',wait_until='networkidle',timeout=60000)
assert response.status==200, 'private draft page unavailable'
page.wait_for_function("!window.MathJax || !MathJax.startup || MathJax.startup.promise",timeout=15000)
page.wait_for_timeout(1500)
# Expand native disclosure widgets without performing any table action.
page.locator('details').evaluate_all('(els)=>els.forEach(el=>el.open=true)')
text=page.locator('body').inner_text();(W/'rendered-page.txt').write_text(text)
(W/'rendered-page.html').write_text(page.content())
page.screenshot(path=str(W/'page-top.png'))
page.screenshot(path=str(W/'page-full.png'),full_page=True)
links=page.locator('a').evaluate_all('(els)=>els.map(e=>({text:e.innerText,href:e.getAttribute("href")}))')
relations={tid:any(tid in str(l['href']) for l in links) for tid in ('T816','T817','T818')}
assert all(relations.values()), 'missing Similar tables link'
math_errors=page.locator('mjx-merror,.MathJax_Error,.katex-error').count()
assert not math_errors and not errors
assert 'Even-odd' in text and '1011' in text
result={'status':response.status,'title':page.title(),'page_errors':errors,'math_errors':math_errors,'relations':relations,'text_characters':len(text),'links':links}
# A read-only history visit checks the exact initial provenance survived filling.
response=page.goto('https://numberdb.org/revisions/T819',wait_until='networkidle',timeout=30000)
hist=page.locator('body').inner_text();(W/'history.txt').write_text(hist)
(W/'history.html').write_text(page.content())
result['history_status']=response.status
result['initial_proposal_citation_preserved']='github.com/numberdb/numberdb-data/issues/386' in hist
result['history_model_recorded']='gpt-6.1-sol' in hist
assert result['initial_proposal_citation_preserved'] and result['history_model_recorded']
(W/'browser-results.json').write_text(json.dumps(result,indent=2))
print(json.dumps({k:v for k,v in result.items() if k!='links'},indent=2))
browser.close()