20 lines
903 B
JavaScript
20 lines
903 B
JavaScript
(async () => {
|
|
const sleep = ms => new Promise(r => setTimeout(r, ms));
|
|
const out = { href: '', title: '', found: [], body: '' };
|
|
out.href = location.href;
|
|
out.title = document.title;
|
|
const txt = (document.body ? document.body.innerText : '') || '';
|
|
out.body = txt.replace(/\s+/g, ' ').slice(0, 20000);
|
|
// 找含关键词的段落
|
|
const kw = ['重复铺货', '重复发布', '重复商品', '同款', '相同商品', '铺货'];
|
|
const lines = txt.split('\n').map(s => s.trim()).filter(Boolean);
|
|
for (const kwd of kw) {
|
|
for (const l of lines) {
|
|
if (l.includes(kwd)) out.found.push({ kw: kwd, line: l.slice(0, 500) });
|
|
}
|
|
}
|
|
out.linkCount = document.querySelectorAll('a[href]').length;
|
|
out.links = Array.from(document.querySelectorAll('a[href]')).map(a => ({ t: (a.innerText||'').trim(), h: a.getAttribute('href') })).filter(x => x.t).slice(0, 60);
|
|
return out;
|
|
})()
|