fix(route): 2048 headers (#13511)
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user