diff --git a/妙手建品/RECIPE.md b/妙手建品/RECIPE.md index 26d54c4..c49fd65 100644 --- a/妙手建品/RECIPE.md +++ b/妙手建品/RECIPE.md @@ -38,3 +38,26 @@ 把 48 条商品的 alicdn 图 + 1688 链接喂进去 2. 走 **`链接采集`**:单条/批量粘贴 1688 链接 3. 采集入箱后,验证「公用采集箱」里能否批量 `认领`/`发布`(受子账号权限限制) + +## 导入采集(`?fetchType=importCopy`)— 四种模式 +| 模式 | 说明 | +|---|---| +| **导入链接采集** | **要文件**(面板里有「下载导入模板」+「确认/取消」),提示语:**「链接地址列必填,其他列选填。若填写其他列,以填写为准,若留空以来源为准。」** | +| **Excel表格导入** | Excel 表格导入 | +| 本地素材包导入 | 本地素材包 | +| 聚水潭素材包导入 | 聚水潭素材包 | + +页面下方是已导入文件列表:`文件名称 / 导入时间 / 解析状态 / 成功条数 / 失败条数 / 操作` +(**文件仅保留 90 天**,当前「暂无数据」)。 + +### ✅ 下一步可直接动手的一条路:用 1688 链接喂「导入链接采集」 +`tk_input.json` 的 key 就是 **1688 商品 id**(如 `676236596821`), +所以每条商品的链接可以直接拼:**`https://detail.1688.com/offer/.html`**(48 条 → 48 行)。 + +步骤: +1. 在面板里点 **「下载导入模板」** 拿到确切列名与格式(列名/是否要表头/单列或多列) +2. 用 48 个 1688 链接生成导入文件(`链接地址` 列必填) +3. 上传 → `确认` → 到「已导入的文件列表」看**解析状态 / 成功条数 / 失败条数** +4. 解析成功后在 **公用采集箱** 里核对待采集商品,再验证子账号能否 `认领`/`发布` + +⚠️ 未验证:模板的确切列名(要先下载模板)、上传控件的选择器、以及**子账号能否发布**。 diff --git a/妙手建品/ms_import.mjs b/妙手建品/ms_import.mjs new file mode 100644 index 0000000..cfe758a --- /dev/null +++ b/妙手建品/ms_import.mjs @@ -0,0 +1,22 @@ +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 wait(1500); +console.log('当前页:', S(String(await c.evalJS('location.href'))).slice(0,80)); +// 点「导入采集」 +console.log('点击:', String(await c.evalJS(`(()=>{const hits=[...document.querySelectorAll('*')].filter(e=>e.offsetParent!==null&&(e.innerText||'').trim()==='导入采集'&&e.children.length===0); + if(!hits.length) return 'nf'; const el=hits[0]; + for(const ev of ['mousedown','mouseup','click']) el.dispatchEvent(new MouseEvent(ev,{bubbles:true,cancelable:true,view:window})); return 'clicked';})()`))); +await wait(6000); +const o = await c.evalJS(`(()=>{ + const mods=[...document.querySelectorAll('.jx-dialog,.jx-drawer,[class*=modal],[class*=dialog]')].filter(e=>e.offsetParent!==null) + .map(e=>({cls:String(e.className).slice(0,40), txt:(e.innerText||'').replace(/\\s+/g,' ').trim().slice(0,300), + inputs:[...e.querySelectorAll('input')].map(i=>({type:i.type,ph:i.placeholder||'',accept:i.accept||''})).slice(0,6), + files:[...e.querySelectorAll('input[type=file]')].length})); + const tabs=[...document.querySelectorAll('[class*=tab]')].filter(e=>e.offsetParent!==null).map(e=>(e.innerText||'').replace(/\\s+/g,' ').trim().slice(0,12)).filter(Boolean); + return JSON.stringify({href:location.href, mods:mods.slice(0,3), tabs:[...new Set(tabs)].slice(0,12), + body:(document.body.innerText||'').replace(/\\s+/g,' ').trim().slice(0,300)});})()`); +console.log('导入采集:', S(String(o)).slice(0,1500)); +try{ await c.shot('/tmp/ms_import.jpg'); console.log('shot ok'); }catch(e){} +process.exit(0); diff --git a/妙手建品/ms_import2.mjs b/妙手建品/ms_import2.mjs new file mode 100644 index 0000000..b4f0377 --- /dev/null +++ b/妙手建品/ms_import2.mjs @@ -0,0 +1,21 @@ +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 wait(1500); +// 关掉新手指南弹窗 +await c.evalJS(`(()=>{const b=[...document.querySelectorAll('.jx-dialog__headerbtn,.jx-dialog__close,button')].find(e=>/关闭|知道了|确定/.test(e.innerText||'')||/close/i.test(String(e.className))); + if(b) b.click(); return 1;})()`); +await wait(1200); +console.log('点导入链接采集:', String(await c.evalJS(`(()=>{const h=[...document.querySelectorAll('*')].filter(e=>e.offsetParent!==null&&(e.innerText||'').trim()==='导入链接采集'&&e.children.length===0); + if(!h.length) return 'nf'; for(const ev of ['mousedown','mouseup','click']) h[0].dispatchEvent(new MouseEvent(ev,{bubbles:true,cancelable:true,view:window})); return 'clicked';})()`))); +await wait(4000); +const o = await c.evalJS(`(()=>{ + const areas=[...document.querySelectorAll('textarea')].filter(e=>e.offsetParent!==null).map(e=>({ph:e.placeholder||'', rows:e.rows})); + const btns=[...document.querySelectorAll('button')].filter(e=>e.offsetParent!==null).map(e=>(e.innerText||'').trim()).filter(Boolean).slice(0,14); + const hints=[...document.querySelectorAll('*')].filter(e=>e.children.length===0&&/链接|一行|示例|模板|1688|淘宝|拼多多/.test(e.innerText||'')&&(e.innerText||'').length<60) + .map(e=>(e.innerText||'').trim()).slice(0,10); + return JSON.stringify({areas, btns:[...new Set(btns)], hints:[...new Set(hints)]});})()`); +console.log('链接采集面板:', S(String(o)).slice(0,1200)); +try{ await c.shot('/tmp/ms_import2.jpg'); console.log('shot ok'); }catch(e){} +process.exit(0);