From 38e4f1ac506e8a7bae436d7ed71581c4a78389af Mon Sep 17 00:00:00 2001 From: Andvari <31068367+dzx-dzx@users.noreply.github.com> Date: Sun, 3 Sep 2023 22:02:23 +0800 Subject: [PATCH] feat(route): Add request throttling for apnews (#13193) * feat(route): Add request throttling for apnews * Update topics.js --- lib/v2/apnews/topics.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/v2/apnews/topics.js b/lib/v2/apnews/topics.js index 573fb2baf5..1ac0d36b69 100644 --- a/lib/v2/apnews/topics.js +++ b/lib/v2/apnews/topics.js @@ -12,6 +12,7 @@ module.exports = async (ctx) => { const items = await Promise.all( $('.PagePromo-content') .get() + .slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : Infinity) .map((e) => ({ title: $(e).find('span.PagePromoContentIcons-text').text(), link: $(e).find('a').attr('href'),