微博热搜不保存 simplify 和 regulation 数据
This commit is contained in:
		@@ -61,11 +61,13 @@ async function main() {
 | 
			
		||||
     * 过滤掉不需要的数据
 | 
			
		||||
     */
 | 
			
		||||
    // hotgov
 | 
			
		||||
    delete data.hotgov["mblog"];
 | 
			
		||||
    // 重复字段只保留一个
 | 
			
		||||
    delete data.hotgov["note"]; // note  word
 | 
			
		||||
    delete data.hotgov["small_icon_desc"]; // icon_desc  small_icon_desc
 | 
			
		||||
    delete data.hotgov["small_icon_desc_color"]; // icon_desc_color  small_icon_desc_color
 | 
			
		||||
    if (data.hotgov) {
 | 
			
		||||
        delete data.hotgov["mblog"];
 | 
			
		||||
        // 重复字段只保留一个
 | 
			
		||||
        delete data.hotgov["note"]; // note  word
 | 
			
		||||
        delete data.hotgov["small_icon_desc"]; // icon_desc  small_icon_desc
 | 
			
		||||
        delete data.hotgov["small_icon_desc_color"]; // icon_desc_color  small_icon_desc_color
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // band_list
 | 
			
		||||
    for (let i = 0; i < data.band_list.length; i++) {
 | 
			
		||||
@@ -154,51 +156,51 @@ async function main() {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 只统计微博调控信息
 | 
			
		||||
     */
 | 
			
		||||
    let convert2 = [];
 | 
			
		||||
    let total = 0;
 | 
			
		||||
    data.band_list.forEach(item => {
 | 
			
		||||
        total += item.num;
 | 
			
		||||
        total -= item.raw_hot;
 | 
			
		||||
        if (item.num - item.raw_hot == 0) return;
 | 
			
		||||
        convert2.push([
 | 
			
		||||
            `[${item.realpos}] ${item.word}【${item.label_name}】`,
 | 
			
		||||
            `原始:${item.raw_hot} 显示:${item.num} 调控: ${item.num - item.raw_hot}`
 | 
			
		||||
        ]);
 | 
			
		||||
    });
 | 
			
		||||
    fileUtils.saveJSON({
 | 
			
		||||
        saveFolder: DATA_FOLDER,
 | 
			
		||||
        now: now,
 | 
			
		||||
        fileNameSuffix: `regulation`,
 | 
			
		||||
        object: {
 | 
			
		||||
            total_delta: total, // 所有调控值之和
 | 
			
		||||
            data: convert2
 | 
			
		||||
        },
 | 
			
		||||
        compress: false,
 | 
			
		||||
        uncompress: true
 | 
			
		||||
    });
 | 
			
		||||
    // /**
 | 
			
		||||
    //  * 只统计微博调控信息
 | 
			
		||||
    //  */
 | 
			
		||||
    // let convert2 = [];
 | 
			
		||||
    // let total = 0;
 | 
			
		||||
    // data.band_list.forEach(item => {
 | 
			
		||||
    //     total += item.num;
 | 
			
		||||
    //     total -= item.raw_hot;
 | 
			
		||||
    //     if (item.num - item.raw_hot == 0) return;
 | 
			
		||||
    //     convert2.push([
 | 
			
		||||
    //         `[${item.realpos}] ${item.word}【${item.label_name}】`,
 | 
			
		||||
    //         `原始:${item.raw_hot} 显示:${item.num} 调控: ${item.num - item.raw_hot}`
 | 
			
		||||
    //     ]);
 | 
			
		||||
    // });
 | 
			
		||||
    // fileUtils.saveJSON({
 | 
			
		||||
    //     saveFolder: DATA_FOLDER,
 | 
			
		||||
    //     now: now,
 | 
			
		||||
    //     fileNameSuffix: `regulation`,
 | 
			
		||||
    //     object: {
 | 
			
		||||
    //         total_delta: total, // 所有调控值之和
 | 
			
		||||
    //         data: convert2
 | 
			
		||||
    //     },
 | 
			
		||||
    //     compress: false,
 | 
			
		||||
    //     uncompress: true
 | 
			
		||||
    // });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 保存预处理后数据
 | 
			
		||||
     */
 | 
			
		||||
    // 过滤掉不需要的数据
 | 
			
		||||
    // band_list
 | 
			
		||||
    data.band_list.forEach(function (item) {
 | 
			
		||||
        delete item["mblog"];
 | 
			
		||||
    });
 | 
			
		||||
    fileUtils.saveJSON({
 | 
			
		||||
        saveFolder: DATA_FOLDER,
 | 
			
		||||
        now: now,
 | 
			
		||||
        fileNameSuffix: `simplify`,
 | 
			
		||||
        object: data,
 | 
			
		||||
        compress: true,
 | 
			
		||||
        // uncompress: true,
 | 
			
		||||
        // compress: false,
 | 
			
		||||
        uncompress: false,
 | 
			
		||||
    });
 | 
			
		||||
    // /**
 | 
			
		||||
    //  * 保存预处理后数据
 | 
			
		||||
    //  */
 | 
			
		||||
    // // 过滤掉不需要的数据
 | 
			
		||||
    // // band_list
 | 
			
		||||
    // data.band_list.forEach(function (item) {
 | 
			
		||||
    //     delete item["mblog"];
 | 
			
		||||
    // });
 | 
			
		||||
    // fileUtils.saveJSON({
 | 
			
		||||
    //     saveFolder: DATA_FOLDER,
 | 
			
		||||
    //     now: now,
 | 
			
		||||
    //     fileNameSuffix: `simplify`,
 | 
			
		||||
    //     object: data,
 | 
			
		||||
    //     compress: true,
 | 
			
		||||
    //     // uncompress: true,
 | 
			
		||||
    //     // compress: false,
 | 
			
		||||
    //     uncompress: false,
 | 
			
		||||
    // });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -207,7 +209,7 @@ async function main() {
 | 
			
		||||
    fs.writeFileSync(`${DATA_FOLDER}/latest.json`, JSON.stringify({
 | 
			
		||||
        update_time: requestTimestamp,
 | 
			
		||||
        update_time_friendly: now.substring(0, 19).replace(/T/g, " "),
 | 
			
		||||
        regulation: convert2,
 | 
			
		||||
        // regulation: convert2,
 | 
			
		||||
        data: convert
 | 
			
		||||
    }));
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user