Skip to content

Commit

Permalink
fix: Fixed the issue of being blocked by the website due to excessive…
Browse files Browse the repository at this point in the history
… concurrent requests, which resulted in failure to retrieve information.
  • Loading branch information
luguoj committed Jan 5, 2025
1 parent 384712d commit dabb3b4
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions lib/routes/agefans/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,27 @@ async function handler() {
};
});

const items = await Promise.all(
list.map((item) =>
cache.tryGet(item.link, async () => {
const detailResponse = await got(item.link);
const content = load(detailResponse.data);
const items:any[] = []
for (const item of list) {

Check failure

Code scanning / ESLint

Require or disallow semicolons instead of ASI Error

Missing semicolon.
const _item = await cache.tryGet(item.link, async () => {
const detailResponse = await got(item.link);
const content = load(detailResponse.data);

content('img').each((_, ele) => {
if (ele.attribs['data-original']) {
ele.attribs.src = ele.attribs['data-original'];
delete ele.attribs['data-original'];
}
});
content('.video_detail_collect').remove();
content('img').each((_, ele) => {
if (ele.attribs['data-original']) {
ele.attribs.src = ele.attribs['data-original'];
delete ele.attribs['data-original'];
}
});
content('.video_detail_collect').remove();

item.description = content('.video_detail_left').html();
item.description = content('.video_detail_left').html();

return item;
})

Check failure

Code scanning / ESLint

Disallow `await` inside of loops Error

Unexpected await inside a loop.
items.push(_item)

Check failure

Code scanning / ESLint

Require or disallow semicolons instead of ASI Error

Missing semicolon.
}

Check failure

Code scanning / ESLint

Require or disallow semicolons instead of ASI Error

Missing semicolon.

return item;
})
)
);

return {
title: $('title').text(),
Expand Down

0 comments on commit dabb3b4

Please sign in to comment.