fix(route): 2048 headers (#13511)

This commit is contained in:
Tony 2023-10-12 15:20:38 +00:00 committed by GitHub
parent 72fdc7d71d
commit 34c9f2f1fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -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 () => {