- TikTok/Shopee/速卖通/Walmart 各 46-47 条已在待发布 - Ozon 47 条已建、改价 40/47 - SHEIN 配方跑通第一条;Temu 差「预览图」一步 - 核心产出:MYJ.message.error 钩子诊断法(解开了三个平台的保存静默拦截) - 含下一轮提示词 NEXT-ROUND-PROMPT.md
36 lines
2.7 KiB
JavaScript
36 lines
2.7 KiB
JavaScript
import { newTarget, CDP } from '/tmp/cdp3.mjs';
|
|
const wait = ms => new Promise(z => setTimeout(z, ms));
|
|
const SHOP = process.argv[2];
|
|
const tl = await (await fetch('http://127.0.0.1:9223/json/list')).json();
|
|
for (const t of tl.filter(x=>x.type==='page'&&/shein/i.test(x.url))) await fetch(`http://127.0.0.1:9223/json/close/${t.id}`).catch(()=>{});
|
|
await wait(1000);
|
|
const t = await newTarget('about:blank');
|
|
const c = await CDP.connect(t.webSocketDebuggerUrl);
|
|
await c.send('Page.enable'); await c.send('Runtime.enable');
|
|
await c.send('Page.navigate',{url:'https://www.dianxiaomi.com/web/sheinProduct/add'});
|
|
await wait(21000);
|
|
const pos = JSON.parse(String(await c.evalJS(`(()=>{const it=[...document.querySelectorAll('.ant-form-item')].filter(e=>e.offsetParent!==null)
|
|
.find(x=>{const l=x.querySelector('label'); return l&&/店铺/.test(l.innerText||'');});
|
|
const s=(it||document).querySelector('.ant-select-selector'); s.scrollIntoView({block:'center'});
|
|
const r=s.getBoundingClientRect(); return JSON.stringify([Math.round(r.x+r.width/2),Math.round(r.y+r.height/2)]);})()`)));
|
|
for (const type of ['mousePressed','mouseReleased']) await c.send('Input.dispatchMouseEvent',{type,x:pos[0],y:pos[1],button:'left',clickCount:1});
|
|
await wait(2500);
|
|
await c.evalJS(`(()=>{const dd=[...document.querySelectorAll('.ant-select-dropdown')].filter(e=>e.offsetParent!==null).pop();
|
|
const hit=[...dd.querySelectorAll('.ant-select-item-option')].find(o=>(o.innerText||'').trim()===${JSON.stringify(SHOP)});
|
|
if(hit) for(const ev of ['mousedown','mouseup','click']) hit.dispatchEvent(new MouseEvent(ev,{bubbles:true,cancelable:true,view:window})); return 1;})()`);
|
|
await wait(8000);
|
|
// 开分类下拉
|
|
const cp = JSON.parse(String(await c.evalJS(`(()=>{const it=[...document.querySelectorAll('.ant-form-item')].filter(e=>e.offsetParent!==null)
|
|
.find(x=>{const l=x.querySelector('label'); return l&&/产品分类/.test(l.innerText||'');});
|
|
const s=it.querySelector('.ant-select-selector'); s.scrollIntoView({block:'center'});
|
|
const r=s.getBoundingClientRect(); return JSON.stringify([Math.round(r.x+r.width/2),Math.round(r.y+r.height/2)]);})()`)));
|
|
for (const type of ['mousePressed','mouseReleased']) await c.send('Input.dispatchMouseEvent',{type,x:cp[0],y:cp[1],button:'left',clickCount:1});
|
|
await wait(3500);
|
|
const o = await c.evalJS(`(()=>{const dd=[...document.querySelectorAll('.ant-select-dropdown')].filter(e=>e.offsetParent!==null).pop();
|
|
if(!dd)return'no-dd';
|
|
const opts=[...dd.querySelectorAll('.ant-select-item-option')].map(e=>(e.innerText||'').replace(/\\s+/g,' ').trim());
|
|
return JSON.stringify({n:opts.length, opts:opts.slice(0,26)});})()`);
|
|
console.log('════', SHOP);
|
|
console.log(String(o).slice(0,1100));
|
|
process.exit(0);
|