TEXT   85   0
   84 707 B    17

Flag Sticky Analysis - Code

By Anon1345
Created: 2021-05-02 12:56:54
Expiry: Never

  1. await (async () => {
  2. const thread = 36933561;
  3. const data = await response.json();
  4. const posts = [data[thread].op, ...Object.values(data[thread].posts)];
  5. return posts
  6. .map(post => JSON.parse(post.exif)?.troll_country_name)
  7. .filter(flag => flag)
  8. .reduceRight((dict, flag, i) => {
  9. dict[flag] = (dict[flag] ?? 0) + 1;
  10. return i > 0 ? dict : Object.entries(dict);
  11. }, {})
  12. .map(([flag, occurrences]) => ({ flag, occurrences }))
  13. .sort((a, b) => b.occurrences - a.occurrences)
  14. .map(({ flag, occurrences }, i) => `>${i + 1}. ${flag}: ${occurrences} posts`)
  15. .join("\n");
  16. })();