19 lines
696 B
JavaScript
19 lines
696 B
JavaScript
// 解析单篇数据列表
|
|
import fs from 'node:fs';
|
|
|
|
const cap = JSON.parse(fs.readFileSync('out/single-capture.json', 'utf8'));
|
|
const target = cap.find(c => c.url.includes('articleListStatistic'));
|
|
if (!target) { console.log('NO_TARGET'); process.exit(1); }
|
|
|
|
const j = JSON.parse(target.body);
|
|
fs.writeFileSync('out/single-parsed.json', JSON.stringify(j, null, 2), 'utf8');
|
|
|
|
const d = j.data || {};
|
|
console.log('KEYS=' + Object.keys(d).join(','));
|
|
const list = d.list || d.items || d.article_list || [];
|
|
console.log('LIST_LEN=' + list.length);
|
|
if (list.length) {
|
|
console.log('SAMPLE_KEYS=' + Object.keys(list[0]).join(','));
|
|
console.log(JSON.stringify(list[0], null, 2).slice(0, 2500));
|
|
}
|