From b08abca7435fe29441e3b89031bcc51668384e89 Mon Sep 17 00:00:00 2001 From: Andvari <31068367+dzx-dzx@users.noreply.github.com> Date: Thu, 21 Sep 2023 17:17:12 +0800 Subject: [PATCH] fix(route): Remove duplicate articles in reuters feed. (#13349) * Remove duplicate articles in reuters feed. * Refining --- lib/v2/reuters/common.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/v2/reuters/common.js b/lib/v2/reuters/common.js index 2bfa07bc23..0fb924f85b 100644 --- a/lib/v2/reuters/common.js +++ b/lib/v2/reuters/common.js @@ -55,8 +55,11 @@ module.exports = async (ctx) => { let items = response.result.articles.map((e) => ({ title: e.title, link: new URL(e.canonical_url, rootUrl).href, + guid: e.id, })); + items = items.filter((e, i) => items.findIndex((f) => e.guid === f.guid) === i); + items = await Promise.all( items.map((item) => ctx.cache.tryGet(item.link, async () => {