bloggers: deduplicate by author name.

If you have multiple feeds referenced in feeds.json, it is undefined which one it will pick.
pull/1/head
Starbeamrainbowlabs 2022-09-04 16:31:31 +01:00
parent c8b3ff9f06
commit f6bad18440
No known key found for this signature in database
GPG Key ID: 1BE5172E637709C2
1 changed files with 5 additions and 1 deletions

View File

@ -7,7 +7,11 @@ const shuffle = require("./lib/shuffle.js");
const fetch_github_user_info = require("./lib/fetch_github_user_info.js");
module.exports = async function() {
const feeds_data = JSON.parse(await fs.promises.readFile(path.resolve(__dirname, "../feeds.json"), "utf-8"));
const author_names = new Set();
const feeds_data = JSON.parse(await fs.promises.readFile(path.resolve(__dirname, "../feeds.json"), "utf-8"))
.filter(feed_item => !author_names.has(feed_item.author_name) && author_names.add(feed_item.author_name));
await Promise.all(feeds_data.map(fetch_github_user_info));
shuffle(feeds_data); // Don't give any 1 person the advantage