From 4d6cd98fc9bb3c528ef07eb6631b0f65ebda10ac Mon Sep 17 00:00:00 2001 From: junfengP <840282629@qq.com> Date: Sat, 12 Mar 2022 17:52:44 +0800 Subject: [PATCH] fix(route): reverse is not a function (#9309) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 很久以前这个路由是正常的,现在报错 $().reverse is not a function 推测是cheerio包的返回类型变了 --- lib/routes/manxiaosi/book.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/routes/manxiaosi/book.js b/lib/routes/manxiaosi/book.js index f7fe949b4..ad2e96edc 100644 --- a/lib/routes/manxiaosi/book.js +++ b/lib/routes/manxiaosi/book.js @@ -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) => {