start-five-topic-multisource.mjs 1.8 KB

123456789101112131415161718
  1. /** Capture a fresh baseline and a bounded, topic-driven discovery plan. */
  2. import fs from 'node:fs';
  3. import {read,publicApi,save} from './lib/research-enrichment.mjs';
  4. const work='work/five-topic-research-20261111';fs.mkdirSync(work,{recursive:true});
  5. const old=JSON.parse(fs.readFileSync('work/five-topic-collection-20261110/collection-plan.json','utf8'));
  6. const topics=old.topics;
  7. const searches={wellness:['药食同源 方便面','菌菇 非油炸 方便面'],student:['宿舍 开水即食 拌面','夜宵 小份 方便面'],
  8. premium:['真肉 高汤 方便面','冻干 方便面'],stockpile:['方便面 多口味 整箱','非油炸 方便面 家庭装'],novelty:['香菜 方便面 新品','冬阴功 拌面']};
  9. const plan={schema:'ksf.five-topic.multisource.v1',topics,scope:old.scope,jobs:topics.flatMap(t=>searches[t.id].map(keyword=>({topic:t.id,platform:'jd',endpoint:'jd.search_item_list_v1',params:{keyword,page:'1'}}))),
  10. evidenceTypes:['ecommerce_product','ecommerce_review','industry_reporting','community_experience','official_policy','ingredient_process_reference'],
  11. rules:['题材相关且有实际正文或商品事实;不采娱乐/邮费/饮料','中式食材不等于健康功效,高端产品不证明购买者收入','保留时间、参数、原件和SHA,按实体类型分开统计']};
  12. save(work+'/collection-plan.json',plan);
  13. const contract=await read('contract');save(work+'/contract-before.json',contract);
  14. save(work+'/summary-before.json',await publicApi({op:'summary',generation:contract.generation}));
  15. for(const entity of ['documents','social']){
  16. if(entity==='documents')save(work+'/documents-before.json',await publicApi({op:'browse',entity,quality:'audit',limit:100,generation:contract.generation}));
  17. }
  18. console.log(JSON.stringify({ok:true,generation:contract.generation,counts:contract.counts,jobs:plan.jobs.length}));