From 95eecbf6ca7c846a6e815b8866e2c0959961693a Mon Sep 17 00:00:00 2001 From: ActonGen Date: Sat, 22 Oct 2022 03:23:52 +0800 Subject: [PATCH] feat(route)!: remove shuquge (#10977) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修复 书趣阁 路由失效 fix shuquge route failure * shuquge route tag add `puppeteer="1"` * fix: remove duplicated route Co-authored-by: 王艮朋 --- docs/reading.md | 44 ++++++++++---------------- lib/router.js | 1 - lib/routes/novel/shuquge.js | 63 ------------------------------------- 3 files changed, 17 insertions(+), 91 deletions(-) delete mode 100644 lib/routes/novel/shuquge.js diff --git a/docs/reading.md b/docs/reading.md index 331b5f0fb..12a86ca37 100644 --- a/docs/reading.md +++ b/docs/reading.md @@ -174,23 +174,23 @@ pageClass: routes ::: -| 网址 | -| ------------------------- | -| | -| | -| | -| | -| | -| | -| | -| | -| | -| | -| | -| | -| | -| | -| | +| 网址 | 名称 | +| -------------------------- | ----- | +| | 笔尖中文 | +| | 笔趣阁 | +| | 笔趣阁 | +| | 顶点小说网 | +| | 笔趣阁 | +| | 笔趣鸽 | +| | 香书小说 | +| | 笔趣阁 | +| | 笔书网 | +| | 笔趣阁 | +| | 笔趣阁 | +| | 笔趣阁 | +| | 爱笔楼 | +| | 书趣阁 | +| | 蚂蚁文学 | ### 小说 @@ -504,16 +504,6 @@ count 的取值范围为 1-12,为防止请求次数过多,推荐设置为 5 -## 书趣阁 - -### 小说更新 - - - -举例网址: - - - ## 文学迷 ### 小说更新 diff --git a/lib/router.js b/lib/router.js index 3de066af4..38089086f 100644 --- a/lib/router.js +++ b/lib/router.js @@ -465,7 +465,6 @@ router.get('/mafengwo/ziyouxing/:code', lazyloadRouteHandler('./routes/mafengwo/ router.get('/novel/uukanshu/:uid', lazyloadRouteHandler('./routes/novel/uukanshu')); router.get('/novel/wenxuemi/:id1/:id2', lazyloadRouteHandler('./routes/novel/wenxuemi')); router.get('/novel/booksky/:id', lazyloadRouteHandler('./routes/novel/booksky')); -router.get('/novel/shuquge/:id', lazyloadRouteHandler('./routes/novel/shuquge')); router.get('/novel/ptwxz/:id1/:id2', lazyloadRouteHandler('./routes/novel/ptwxz')); router.get('/novel/zhaishuyuan/:id', lazyloadRouteHandler('./routes/novel/zhaishuyuan')); diff --git a/lib/routes/novel/shuquge.js b/lib/routes/novel/shuquge.js deleted file mode 100644 index dbb16a8f6..000000000 --- a/lib/routes/novel/shuquge.js +++ /dev/null @@ -1,63 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const iconv = require('iconv-lite'); - -const baseUrl = 'http://www.sizhicn.com/txt/'; -// 获取小说的最新章节列表 -module.exports = async (ctx) => { - const id = ctx.params.id; // 小说id - - const response = await got({ - method: 'get', - url: `${baseUrl}${id}/index.html`, - responseType: 'buffer', - }); - const responseHtml = iconv.decode(response.data, 'utf-8'); - const $ = cheerio.load(responseHtml); - const title = $('.listmain>dl>dt').eq(0).text(); - const description = $('.intro').text(); - const cover_url = $('.cover>img').eq(0).attr('src'); - const list = $('.listmain dd').slice(0, 9); - const chapter_item = list - .find('a') - .map((_, e) => ({ - title: e.children[0].data, - link: `${baseUrl}${id}/${e.attribs.href}`, - })) - .get(); - - const items = await Promise.all( - chapter_item.map(async (item) => { - const cache = await ctx.cache.get(item.link); - if (cache) { - return Promise.resolve(JSON.parse(cache)); - } - - const response = await got({ - method: 'get', - url: item.link, - responseType: 'buffer', - }); - - const responseHtml = iconv.decode(response.data, 'utf-8'); - const $ = cheerio.load(responseHtml); - - const description = $('#content').html(); - - const single = { - title: item.title, - description, - link: item.link, - }; - ctx.cache.set(item.link, JSON.stringify(single)); - return Promise.resolve(single); - }) - ); - ctx.state.data = { - title: `书趣阁 ${title}`, - link: `${baseUrl}${id}/index.html`, - image: cover_url, - description, - item: items, - }; -};