back to table · edit · history · where entries came from · files · download
3149 bytes, as of the version from 2026-11-20 01:33 (current). Recorded here, not run.
import os,json,urllib.parse
from pathlib import Path
from playwright.sync_api import sync_playwright
p=Path(os.environ['TMPDIR']);key=Path(os.environ['NUMBERDB_KEY_FILE']).read_text().strip();out={};errors=[]
with sync_playwright() as pw:
browser=pw.chromium.launch(headless=True,args=['--no-sandbox','--disable-dev-shm-usage','--disable-gpu'])
context=browser.new_context(viewport={'width':1440,'height':1050},device_scale_factor=1)
def route_handler(route):
headers=dict(route.request.headers)
if urllib.parse.urlparse(route.request.url).hostname=='numberdb.org':headers['Authorization']='Bearer '+key
else:headers.pop('authorization',None);headers.pop('Authorization',None)
route.continue_(headers=headers)
context.route('**/*',route_handler)
page=context.new_page();page.on('pageerror',lambda err:errors.append(str(err)))
response=page.goto('https://numberdb.org/T769',wait_until='domcontentloaded',timeout=45000)
page.wait_for_timeout(1500)
out['http_status']=response.status;out['title']=page.title();out['math_errors']=page.locator('mjx-merror, .merror').all_text_contents();out['page_errors']=errors
page.screenshot(path=str(p/'render-top.png'))
section=page.get_by_text('Similar tables',exact=True);out['similar_heading_count']=section.count()
if section.count():section.first.scroll_into_view_if_needed();page.screenshot(path=str(p/'render-similar.png'))
relations={}
for tid in ['T732','T129','T211','T349']:
locator=page.locator('a[href="'+tid+'"],a[href="/'+tid+'"],a[href="https://numberdb.org/'+tid+'"]')
relations[tid]={'links':locator.count(),'texts':locator.all_text_contents()}
out['related_links']=relations
text=page.locator('body').inner_text();out['unresolved_citations']=[s for s in ['CITE{','HREF{'] if s in text]
out['origin_issue_prose']=any(s in text for s in ['issues/351','issues/264'])
out['declared_coverage_visible']='468 individual points' in text
out['reference_labels']={k:page.locator('[id="'+k+'"]').count() for k in ['Watkins','Ogg','SageModsym','SageArb','SageParam']}
out['entry_rows']=page.locator('[id]').evaluate_all('(els)=>els.map(e=>e.id).filter(s=>s.startsWith("11,-7,"))')
page.evaluate('window.scrollTo(0,document.body.scrollHeight)');page.screenshot(path=str(p/'render-bottom.png'))
page.goto('https://numberdb.org/revisions/T769',wait_until='domcontentloaded',timeout=45000)
history=page.locator('body').inner_text();out['history_initial_citations']={n:('issues/'+n in history or page.locator('a[href="https://github.com/numberdb/numberdb-data/issues/'+n+'"]').count()>0) for n in ['351','264']};out['history_model_visible']='gpt-6.1-sol' in history;out['history_engine_visible']='codex-cli' in history
(p/'history-rendered.txt').write_text(history)
browser.close()
(p/'render-results.json').write_text(json.dumps(out,indent=2))
assert out['http_status']==200 and not out['math_errors'] and not out['unresolved_citations']
assert out['similar_heading_count']==1 and all(r['links']>0 for r in relations.values())
assert all(out['history_initial_citations'].values())
(p/'render-results.json').write_text(json.dumps(out,indent=2));print(json.dumps(out,indent=2))