fix(route): reverse is not a function (#9309)

很久以前这个路由是正常的,现在报错 $().reverse is not a function
推测是cheerio包的返回类型变了
This commit is contained in:
junfengP 2022-03-12 17:52:44 +08:00 committed by GitHub
parent 01146e3e6f
commit 4d6cd98fc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -8,7 +8,7 @@ module.exports = async (ctx) => {
const url = host + `/book/${id}`;
const response = await got.get(url);
const $ = cheerio.load(response.data);
const list = $('#detail-list-select > li > a').reverse().slice(0, 10).get();
const list = $('#detail-list-select > li > a').get().reverse().slice(0, 10);
const items = await Promise.all(
list.map(async (item) => {