diff --git a/lib/routes/manhuagui/comic.js b/lib/routes/manhuagui/comic.js index 7923e562e..48f70f9eb 100644 --- a/lib/routes/manhuagui/comic.js +++ b/lib/routes/manhuagui/comic.js @@ -3,16 +3,26 @@ const cheerio = require('cheerio'); const axios = require('../../utils/axios'); const getChapters = ($) => - $('.chapter-list > ul li') - .map((_, ele) => { + $('.chapter-list > ul') + .toArray() + .reverse() + .reduce( + (acc, curr) => + acc.concat( + $(curr) + .children('li') + .toArray() + ), + [] + ) + .map((ele) => { const a = $(ele).children('a'); return { link: resolve('https://www.manhuagui.com/', a.attr('href')), title: a.attr('title'), num: a.find('i').text(), }; - }) - .toArray(); + }); module.exports = async (ctx) => { const { id } = ctx.params;