diff --git a/lib/v2/u9a9/index.js b/lib/v2/u9a9/index.js index 5d3b3b6d5..b225c521d 100644 --- a/lib/v2/u9a9/index.js +++ b/lib/v2/u9a9/index.js @@ -21,7 +21,7 @@ module.exports = async (ctx) => { const { data: response } = await got(link); const $ = cheerio.load(response); - const items = $('table tr') + const list = $('table tr') .slice(1) // skip thead .toArray() .map((item) => { @@ -43,20 +43,20 @@ module.exports = async (ctx) => { }; }); - if (preview) { - await Promise.all( - items.map((item) => - ctx.cache.tryGet(item.link, async () => { - const { data: response } = await got(item.link); - const $ = cheerio.load(response); + const items = preview + ? await Promise.all( + list.map((item) => + ctx.cache.tryGet(item.link, async () => { + const { data: response } = await got(item.link); + const $ = cheerio.load(response); - item.description = $('.panel-body').eq(1).html(); + item.description = $('.panel-body').eq(1).html(); - return item; - }) - ) - ); - } + return item; + }) + ) + ) + : list; ctx.state.data = { title,