import { attach } from '/tmp/cdp3.mjs'; import fs from 'fs'; const c = await attach('/web/temu/add') || await attach('dianxiaomi.com'); const o = await c.evalJS(`(()=>{const p=document.querySelector('#app').__vue_app__.config.globalProperties.$pinia; const s=p._s.get('temuAddBasicStore').$state.dataState; let cats=s.categories; if(typeof cats==='string') cats=JSON.parse(cats); return JSON.stringify(cats.map(x=>({id:String(x.categoryId), name:x.nameZh, path:x.nodePath||''})));})()`); const list = JSON.parse(String(o)); fs.writeFileSync('/tmp/temu_cats_full.json', JSON.stringify(list,null,1)); console.log('Temu 全量类目:', list.length); const KEYS=['发夹','发饰','发圈','发箍','头绳','贴纸','墙贴','钥匙','笔袋','卡包','卡夹','化妆包','袜','收纳','项链','书签','纽扣','口哨','毛线','温度计','围巾']; for(const k of KEYS){ const hits=list.filter(x=>x.name.includes(k)).slice(0,5); if(hits.length) console.log(` [${k}] ` + hits.map(h=>h.name).join(' / ')); } process.exit(0);