Skip to content

Commit

Permalink
fix(route): 2048 headers (#13511)
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyRL authored Oct 12, 2023
1 parent 72fdc7d commit 34c9f2f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/v2/2048/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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 () => {
Expand Down

0 comments on commit 34c9f2f

Please sign in to comment.