process.js 842 B

123456789101112131415161718192021222324252627282930313233
  1. import fs from 'fs'
  2. let read = './data/detail_comments_2024-03-29.json'
  3. let video_ids = [
  4. '7260749400622894336',
  5. '7128686458763889956',
  6. '7293100687989148943',
  7. '6923214072347512068',
  8. '7005490661592026405',
  9. '7161000281575148800',
  10. '7267478481213181238',
  11. '6686589698707590411',
  12. '7321200290739326262',
  13. '7194815099381484860',
  14. '6826943630775831812',
  15. '7110263965858549003',
  16. '7295697246132227343',
  17. '7270431418822446370',
  18. '6882368275695586568',
  19. '7000587983069957383',
  20. ]
  21. let saveFileStr = fs.readFileSync(read, 'utf8')
  22. let data = JSON.parse(saveFileStr)
  23. video_ids.map((v) => {
  24. let video_comments = data.filter((a) => a.aweme_id == v)
  25. console.log('v', v, 'c', video_comments.length)
  26. fs.writeFileSync(
  27. `./video_id_${v}.json`,
  28. JSON.stringify(video_comments, null, 2),
  29. )
  30. })
  31. console.log('data', data.length)