TEXT   91   0
   84 707 B    17

Flag Sticky Analysis - Code

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

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