diff --git a/lib/routes/gamer/gnn-index.ts b/lib/routes/gamer/gnn-index.ts index 7ffe464fb..be85e1a55 100644 --- a/lib/routes/gamer/gnn-index.ts +++ b/lib/routes/gamer/gnn-index.ts @@ -4,6 +4,7 @@ import got from '@/utils/got'; import { load } from 'cheerio'; import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; +import pMap from 'p-map'; export const route: Route = { path: '/gnn/:category?', @@ -94,6 +95,8 @@ async function handler(ctx) { const list = $('div.BH-lbox.GN-lbox2') .children() .not('p,a,img,span') + //
+ .not('[data-news-id]') .slice(0, limit) .toArray() .map((item) => { @@ -116,8 +119,9 @@ async function handler(ctx) { }; }); - const items = await Promise.all( - list.map(async (item) => { + const items = await pMap( + list, + async (item) => { item.description = await cache.tryGet(item.link, async () => { const response = await got.get(item.link); let component = ''; @@ -163,7 +167,8 @@ async function handler(ctx) { return component; }); return item; - }) + }, + { concurrency: 5 } ); return {