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,43 @@
|
||||
// 解析抓到的接口数据
|
||||
import fs from 'node:fs';
|
||||
|
||||
const cap = JSON.parse(fs.readFileSync('out/analysis-capture.json', 'utf8'));
|
||||
const find = (kw) => cap.filter(c => c.url.includes(kw));
|
||||
|
||||
const out = {};
|
||||
for (const c of cap) {
|
||||
if (c.url.includes('appStatisticV3')) out.appStatistic = JSON.parse(c.body);
|
||||
else if (c.url.includes('getauthorsubmission')) out.submission = JSON.parse(c.body);
|
||||
else if (c.url.includes('authorPublishStatistic')) out.publishStat = JSON.parse(c.body);
|
||||
else if (c.url.includes('getauthordiagnosis')) out.diagnosis = (out.diagnosis || []).concat([JSON.parse(c.body)]);
|
||||
}
|
||||
|
||||
fs.writeFileSync('out/parsed.json', JSON.stringify(out, null, 2), 'utf8');
|
||||
|
||||
// 打印结构摘要(ASCII-safe 键名,值可能含中文,写到文件里看)
|
||||
function shape(o, depth = 0, prefix = '') {
|
||||
const lines = [];
|
||||
if (depth > 4) return lines;
|
||||
if (Array.isArray(o)) {
|
||||
lines.push(`${prefix}[array len=${o.length}]`);
|
||||
if (o.length) lines.push(...shape(o[0], depth + 1, prefix + ' [0].'));
|
||||
} else if (o && typeof o === 'object') {
|
||||
for (const k of Object.keys(o).slice(0, 30)) {
|
||||
const v = o[k];
|
||||
if (v && typeof v === 'object') {
|
||||
lines.push(`${prefix}${k}: ${Array.isArray(v) ? 'array(' + v.length + ')' : 'obj'}`);
|
||||
lines.push(...shape(v, depth + 1, prefix + ' '));
|
||||
} else {
|
||||
lines.push(`${prefix}${k} = ${String(v).slice(0, 60)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
for (const [k, v] of Object.entries(out)) {
|
||||
const arr = Array.isArray(v) ? v[0] : v;
|
||||
console.log('=== ' + k + ' ===');
|
||||
console.log(shape(arr).slice(0, 60).join('\n'));
|
||||
console.log('');
|
||||
}
|
||||
Reference in new issue
Block a user