import { listPages, wait } from '/home/admin9webs/shein建品/sh_lib.mjs'; import { CDP, SAN as S } from '/tmp/cdp3.mjs'; const t = (await listPages()).find(x=>/91miaoshou/i.test(x.url)); const c = await CDP.connect(t.webSocketDebuggerUrl); await c.send('Page.enable'); await c.send('Runtime.enable'); await c.send('Page.navigate', { url: 'https://erp.91miaoshou.com/common_collect_box/index?fetchType=importCopy' }); await wait(12000); const o = await c.evalJS(`(()=>{const rows=[...document.querySelectorAll('tr')].filter(e=>e.offsetParent!==null) .map(e=>(e.innerText||'').replace(/\\s+/g,' ').trim()).filter(t=>t&&!/文件名称/.test(t)&&/ms_import|解析|成功|失败/.test(t)).slice(0,4); return JSON.stringify({rows});})()`); console.log('导入列表:', S(String(o)).slice(0,600)); try{ await c.shot('/tmp/ms_status.jpg'); console.log('shot ok'); }catch(e){} process.exit(0);