Skip to content

Commit

Permalink
feat(route): Add request throttling for apnews (#13193)
Browse files Browse the repository at this point in the history
* feat(route): Add request throttling for apnews

* Update topics.js
  • Loading branch information
dzx-dzx authored Sep 3, 2023
1 parent c6b5acc commit 38e4f1a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/v2/apnews/topics.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down

0 comments on commit 38e4f1a

Please sign in to comment.