fix(route): reverse is not a function (#9309)
很久以前这个路由是正常的,现在报错 $().reverse is not a function 推测是cheerio包的返回类型变了
This commit is contained in:
parent
01146e3e6f
commit
4d6cd98fc9
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue