vault backup: 2026-11-09 09:18:58
This commit is contained in:
1 parent
856d0203da
commit
75072389db
42 files changed
+5994
-37
No files matched your search
@@ -0,0 +1,29 @@
|
||||
// 通过常驻桥查询评论管理页,抓评论列表接口
|
||||
import { evalViaBridge, health } from './client.mjs';
|
||||
import fs from 'node:fs';
|
||||
|
||||
console.log('health=' + JSON.stringify(await health()));
|
||||
|
||||
// 装钩子并导航到评论管理页
|
||||
await evalViaBridge(`(() => {
|
||||
window.__CAP = [];
|
||||
const oOpen = XMLHttpRequest.prototype.open;
|
||||
const oSend = XMLHttpRequest.prototype.send;
|
||||
XMLHttpRequest.prototype.open = function(m,u){ this.__u=u; return oOpen.apply(this,arguments); };
|
||||
XMLHttpRequest.prototype.send = function(){
|
||||
this.addEventListener('load', () => {
|
||||
try { const ct=this.getResponseHeader('content-type')||''; if(ct.includes('json') && this.responseText) window.__CAP.push({url:this.__u, body:this.responseText.slice(0,400000)}); } catch(e){}
|
||||
});
|
||||
return oSend.apply(this,arguments);
|
||||
};
|
||||
return 'hooked';
|
||||
})()`);
|
||||
|
||||
await evalViaBridge(`location.href='https://baijiahao.baidu.com/builder/rc/commentmanage/comment/all'`);
|
||||
await new Promise(r => setTimeout(r, 12000));
|
||||
|
||||
const cap = await evalViaBridge(`(window.__CAP||[]).map(x=>({url:x.url, body:x.body}))`);
|
||||
fs.writeFileSync('out/comment-capture.json', JSON.stringify(cap, null, 2), 'utf8');
|
||||
console.log('CAP=' + (cap || []).length);
|
||||
for (const c of cap || []) console.log('API ' + String(c.url).slice(0, 170));
|
||||
process.exit(0);
|
||||
Reference in new issue
Block a user