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