vault backup: 2026-11-06 20:22:25
This commit is contained in:
1 parent
c2f97640b7
commit
a8080408a7
7 files changed
+344
No files matched your search
@@ -0,0 +1,27 @@
|
||||
(async () => {
|
||||
const sleep = ms => new Promise(r => setTimeout(r, ms));
|
||||
// 等正文渲染
|
||||
let txt = '';
|
||||
for (let i = 0; i < 20; i++) {
|
||||
txt = (document.body ? document.body.innerText : '') || '';
|
||||
if (txt.length > 2000) break;
|
||||
await sleep(800);
|
||||
}
|
||||
const out = { href: location.href, title: document.title, len: txt.length, hits: [], all: '' };
|
||||
const clean = txt.replace(/\r/g, '');
|
||||
out.all = clean.slice(0, 60000);
|
||||
const kws = ['重复', '铺货', '同款', '相同商品', '重复发布', '重复铺货'];
|
||||
const lines = clean.split('\n').map(s => s.trim()).filter(Boolean);
|
||||
const seen = new Set();
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const l = lines[i];
|
||||
if (kws.some(k => l.includes(k))) {
|
||||
const ctx = lines.slice(Math.max(0, i - 1), Math.min(lines.length, i + 3)).join(' ⏎ ');
|
||||
const key = l.slice(0, 60);
|
||||
if (seen.has(key)) continue;
|
||||
seen.add(key);
|
||||
out.hits.push({ line: l.slice(0, 600), ctx: ctx.slice(0, 1200) });
|
||||
}
|
||||
}
|
||||
return out;
|
||||
})()
|
||||
Reference in new issue
Block a user