function render(d){const r=d.result||{};let html=`
${esc(r.status||'-')}${esc(d.target||'-')}
真实抓取
${metric('页面状态',r.status_code||'-')}${metric('备案号数量',(r.records||[]).length)}${metric('备案链接数量',(r.beian_links||[]).length)}
`; (r.records||[]).forEach(x=>{html+=`
${esc(x)}页面中识别到的公网安备号文本
`}); (r.beian_links||[]).forEach(x=>{html+=`
${esc(x)}页面中识别到的公安备案链接
`}); if(!(r.records||[]).length && !(r.beian_links||[]).length){html+='
未在页面 HTML 中发现公安备案展示。
'} return html+'
'+raw(d)}async function run(){const u=$('url').value.trim();if(!u)return alert('请输入 URL');$('result').innerHTML='
正在真实抓取公安备案展示信息...
';const d=await fetch('/api/gongan-beian?url='+encodeURIComponent(u)).then(r=>r.json()).catch(e=>({ok:false,error:e.message}));$('result').innerHTML=d.ok?render(d):`
检测失败${esc(d.error||'未知错误')}
`}const q=new URLSearchParams(location.search);if(q.get('url'))$('url').value=q.get('url');if(q.get('auto')==='1')setTimeout(run,120);