From 26d4afcd56e9dc74730b34d902009527b608fa8b Mon Sep 17 00:00:00 2001 From: Tony Date: Sun, 24 Dec 2023 15:54:46 +0000 Subject: [PATCH] fix(route): gamme (#14108) --- lib/v2/gamme/category.js | 4 ++-- lib/v2/gamme/tag.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/v2/gamme/category.js b/lib/v2/gamme/category.js index 50e762fb03091e..88f1336f308d6b 100644 --- a/lib/v2/gamme/category.js +++ b/lib/v2/gamme/category.js @@ -11,7 +11,7 @@ module.exports = async (ctx) => { const baseUrl = `https://${domain}.gamme.com.tw`; const feed = await parser.parseURL(`${baseUrl + (category ? `/category/${category}` : '')}/feed`); - await Promise.all( + const items = await Promise.all( feed.items.map((item) => ctx.cache.tryGet(item.link, async () => { const { data } = await got(item.link); @@ -45,6 +45,6 @@ module.exports = async (ctx) => { link: feed.link, image: domain === 'news' ? `${baseUrl}/blogico.ico` : `${baseUrl}/favicon.ico`, description: feed.description, - item: feed.items, + item: items, }; }; diff --git a/lib/v2/gamme/tag.js b/lib/v2/gamme/tag.js index eaf7134ba8c9bc..df9ddc0b394d7c 100644 --- a/lib/v2/gamme/tag.js +++ b/lib/v2/gamme/tag.js @@ -14,7 +14,7 @@ module.exports = async (ctx) => { const { data } = await got(pageUrl); const $ = cheerio.load(data); - const items = $('#category_new li a, .List-4 h3 a') + const list = $('#category_new li a, .List-4 h3 a') .toArray() .map((item) => { item = $(item); @@ -24,8 +24,8 @@ module.exports = async (ctx) => { }; }); - await Promise.all( - items.map((item) => + const items = await Promise.all( + list.map((item) => ctx.cache.tryGet(item.link, async () => { const { data } = await got(item.link); const $ = cheerio.load(data);