妙手:复核采集箱仍为空;确认「导入≠已采集」并列出三个待验证触发点(关联货源筛选/行内更多菜单/采集设置)
This commit is contained in:
1 parent
86845d5a6e
commit
32d7df3644
4 files changed
+70
No files matched your search
@@ -182,3 +182,23 @@ await c.send('DOM.setFileInputFiles', { files: ['/path/ms_import.csv'], nodeId }
|
|||||||
### 复用脚本
|
### 复用脚本
|
||||||
`ms_box.mjs`(进采集箱 dump 按钮/列表)、`ms_task.mjs`(读任务记录)、
|
`ms_box.mjs`(进采集箱 dump 按钮/列表)、`ms_task.mjs`(读任务记录)、
|
||||||
`ms_items.mjs`(点「查看导入产品」)、`ms_status.mjs`(导入列表状态)、`ms_reason.mjs`(查看失败原因)。
|
`ms_items.mjs`(点「查看导入产品」)、`ms_status.mjs`(导入列表状态)、`ms_reason.mjs`(查看失败原因)。
|
||||||
|
|
||||||
|
## 再查一次(仍为空)+ 三个待验证假设
|
||||||
|
|
||||||
|
复核结果:
|
||||||
|
- 导入任务 `ms2`:**解析成功 47/0/47**(文件层面没问题)
|
||||||
|
- 公用采集箱 `/common_collect_box/items`:**仍为空**(`暂无数据`,行数 0)
|
||||||
|
- 「任务记录」:表头在、**无数据行**
|
||||||
|
- 在导入列表点 **「查看导入产品」**(DOM 点击 + **真实鼠标点击**都试过):
|
||||||
|
**无弹窗、无新标签、URL 不变** —— 这个入口不是「开始采集」的意思
|
||||||
|
|
||||||
|
采集箱的筛选字段是:`关联货源 / 产品标题 / 货源ID / 货源价格`。
|
||||||
|
|
||||||
|
### 下一步优先验证(按可能性排序)
|
||||||
|
1. **关联货源筛选**:采集箱默认可能过滤了货源;把 `关联货源` 选成 **1688**(或「全部」)再看
|
||||||
|
—— 我们这批就是 1688 链接,很可能被默认筛选藏住了;
|
||||||
|
2. **导入文件行的「更多」菜单**:导入列表每行有 `更多` → 看里面是否有「开始采集 / 采集设置 / 认领」之类动作;
|
||||||
|
3. **采集设置**:页面顶部有 `采集设置`,可能要求先配置采集参数/翻译/图片来源,否则任务不启动。
|
||||||
|
|
||||||
|
⚠️ 结论:**导入≠已采集**。`解析成功` 只代表表格被接受,真正抓取需要触发(或等到队列跑)。
|
||||||
|
判定标准只有一个:**公用采集箱里出现 47 条**。
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
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/items'});
|
||||||
|
await wait(12000);
|
||||||
|
const o = await c.evalJS(`(()=>{
|
||||||
|
const body=(document.body.innerText||'').replace(/\\s+/g,' ');
|
||||||
|
const m=body.match(/共\\s*\\d+\\s*[条个]/);
|
||||||
|
const rows=[...document.querySelectorAll('tr')].filter(e=>e.offsetParent!==null).map(e=>(e.innerText||'').replace(/\\s+/g,' ').trim()).filter(Boolean);
|
||||||
|
const empty=/暂无数据|没有数据/.test(body);
|
||||||
|
return JSON.stringify({total:m?m[0]:'', rowCount:rows.length, first:rows.slice(0,4), empty,
|
||||||
|
body:(body||'').slice(0,220)});})()`);
|
||||||
|
console.log('采集箱:', S(String(o)).slice(0,900));
|
||||||
|
try{ await c.shot('/tmp/ms_recheck.jpg'); console.log('shot ok'); }catch(e){}
|
||||||
|
process.exit(0);
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import { listPages } from '/home/admin9webs/shein建品/sh_lib.mjs';
|
||||||
|
const ps = (await listPages()).filter(x=>/91miaoshou/i.test(x.url));
|
||||||
|
console.log('妙手标签数:', ps.length);
|
||||||
|
ps.forEach(p=>console.log(' ', p.url.slice(0,95)));
|
||||||
|
process.exit(0);
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
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 pos = JSON.parse(String(await c.evalJS(`(()=>{
|
||||||
|
const rows=[...document.querySelectorAll('tr')].filter(e=>e.offsetParent!==null&&/^\\s*ms2\\s/.test((e.innerText||'').trim()));
|
||||||
|
const row=rows[0]; if(!row) return '[]';
|
||||||
|
const a=[...row.querySelectorAll('*')].find(e=>(e.innerText||'').trim()==='查看导入产品'&&e.children.length===0);
|
||||||
|
if(!a) return '[]'; a.scrollIntoView({block:'center'}); const r=a.getBoundingClientRect();
|
||||||
|
return JSON.stringify([Math.round(r.x+r.width/2),Math.round(r.y+r.height/2)]);})()`)));
|
||||||
|
console.log('查看导入产品坐标:', JSON.stringify(pos));
|
||||||
|
if(pos.length){
|
||||||
|
await c.send('Input.dispatchMouseEvent',{type:'mouseMoved',x:pos[0],y:pos[1],buttons:0}); await wait(300);
|
||||||
|
for(const tp of ['mousePressed','mouseReleased']) await c.send('Input.dispatchMouseEvent',{type:tp,x:pos[0],y:pos[1],button:'left',clickCount:1,buttons:1});
|
||||||
|
}
|
||||||
|
await wait(8000);
|
||||||
|
const o = await c.evalJS(`(()=>{
|
||||||
|
const dlgs=[...document.querySelectorAll('.jx-dialog,.jx-drawer,[class*=dialog]')].filter(e=>e.offsetParent!==null)
|
||||||
|
.map(e=>({txt:(e.innerText||'').replace(/\\s+/g,' ').trim().slice(0,400),
|
||||||
|
btns:[...e.querySelectorAll('button')].map(b=>(b.innerText||'').trim()).filter(Boolean).slice(0,10)}));
|
||||||
|
return JSON.stringify({href:location.href, dlgs:dlgs.slice(0,2),
|
||||||
|
newTab:''});})()`);
|
||||||
|
console.log('结果:', S(String(o)).slice(0,1000));
|
||||||
|
try{ await c.shot('/tmp/ms_view.jpg'); console.log('shot ok'); }catch(e){}
|
||||||
|
process.exit(0);
|
||||||
Reference in new issue
Block a user