53 lines
1.8 KiB
JavaScript
53 lines
1.8 KiB
JavaScript
// 输出每日 7 天完整指标 + 流量来源
|
|
import fs from 'node:fs';
|
|
|
|
const out = JSON.parse(fs.readFileSync('out/parsed.json', 'utf8'));
|
|
const app = out.appStatistic.data;
|
|
const lines = [];
|
|
const p = (s) => lines.push(s);
|
|
|
|
const FIELDS = [
|
|
['event_day', '日期'],
|
|
['publish_count', '发布量'],
|
|
['view_count', '阅读/播放量'],
|
|
['disp_pv', '曝光量'],
|
|
['click_rate', '点击率%'],
|
|
['completion_view_rate', '完播率%'],
|
|
['view_3s_rate', '3秒留存%'],
|
|
['avg_play_duration', '均播放时长s'],
|
|
['likes_count', '点赞'],
|
|
['comment_count', '评论'],
|
|
['share_count', '分享'],
|
|
['collect_count', '收藏'],
|
|
['fans_add_cnt', '涨粉'],
|
|
['hudong_rate', '互动率%'],
|
|
['search_click_pv', '搜索点击'],
|
|
['uninterested_count', '不感兴趣'],
|
|
];
|
|
|
|
p('=== 近7天每日数据 ===');
|
|
p(FIELDS.map(f => f[1]).join('\t'));
|
|
for (const row of app.list) {
|
|
p(FIELDS.map(f => {
|
|
const v = row[f[0]];
|
|
return v === undefined || v === '' ? '-' : v;
|
|
}).join('\t'));
|
|
}
|
|
|
|
p('\n=== 7天合计/均值 (total_info) ===');
|
|
for (const f of ['view_count','disp_pv','click_rate','completion_view_rate','view_3s_rate','avg_play_duration','likes_count','comment_count','share_count','collect_count','fans_add_cnt','hudong_rate','publish_count','valid_play_pv','real_view_count','fake_view_count']) {
|
|
const v = app.total_info[f];
|
|
if (v !== undefined) p(`${f} = ${v} (环比 ${app.total_info[f + '_hb'] ?? '-'})`);
|
|
}
|
|
|
|
p('\n=== 流量来源 (近30日) ===');
|
|
const ch = app.channel_view_count;
|
|
if (ch) for (const [k, v] of Object.entries(ch)) p(`${k}: ${JSON.stringify(v)}`);
|
|
|
|
p('\n=== 投稿效率 (publishStat 11-01~11-07) ===');
|
|
const t = out.publishStat.data.total_info;
|
|
for (const [k, v] of Object.entries(t)) p(`${k} = ${v}`);
|
|
|
|
fs.writeFileSync('out/daily.txt', lines.join('\n'), 'utf8');
|
|
console.log('done, lines=' + lines.length);
|