From 34c9f2f1fef1e4639d57003a77cbd33c94dc9d09 Mon Sep 17 00:00:00 2001 From: Tony Date: Thu, 12 Oct 2023 15:20:38 +0000 Subject: [PATCH] fix(route): 2048 headers (#13511) --- lib/v2/2048/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/v2/2048/index.js b/lib/v2/2048/index.js index 186f7ab4a..7587a8c50 100644 --- a/lib/v2/2048/index.js +++ b/lib/v2/2048/index.js @@ -11,7 +11,11 @@ module.exports = async (ctx) => { const rootUrl = 'https://hjd2048.com'; const entranceDomain = await ctx.cache.tryGet('2048:entranceDomain', async () => { - const { data: response } = await got('https://hjd.tw'); + const { data: response } = await got('https://hjd.tw', { + headers: { + accept: '*/*', + }, + }); const $ = cheerio.load(response); return $('ul li a') .toArray() @@ -43,7 +47,9 @@ module.exports = async (ctx) => { link: `${currentHost}/2048/${item.attr('href')}`, guid: `${rootUrl}/2048/${item.attr('href')}`, }; - }); + }) + .filter((item) => !item.link.includes('undefined')); + const items = await Promise.all( list.map((item) => ctx.cache.tryGet(item.guid, async () => {