feat(route): add support for linovelib 哩哔轻小说 (#10757)

* add support for linovelib

* move readme from anime to reading
This commit is contained in:
Zhanbo Huang
2022-09-10 17:09:39 +03:00
committed by GitHub
parent 69cd00d1a4
commit e712ee3a1a
5 changed files with 58 additions and 0 deletions
+6
View File
@@ -371,6 +371,12 @@ count 的取值范围为 1-12,为防止请求次数过多,推荐设置为 5
</Route>
## 哩哔轻小说
### 小说更新
<Route author="misakicoca" path="/linovelib/novel/:id" example="/linovelib/novel/2547" :paramsDesc="['小说 id,对应书架开始阅读 URL 中找到']"/>
## 飘天文学
### 章节
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
'/novel/:id': ['misakicoca'],
};
+33
View File
@@ -0,0 +1,33 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await got(`https://www.linovelib.com/novel/${ctx.params.id}/catalog`);
const $ = cheerio.load(response.data);
const meta = $('.book-meta');
const title = meta.children().first().text();
const author = meta.find('p > span > a').text();
const list = $('.chapter-list');
const items = list
.find('li')
.find('a')
.filter((idx, item) => $(item).attr('href').startsWith('/novel/'))
.map((idx, item) => ({
title: $(item).text(),
author,
description: $(item).text(),
link: `https://www.linovelib.com${$(item).attr('href')}`,
}))
.get();
items.reverse();
ctx.state.data = {
title: `哩哔轻小说 - ${title}`,
link: `https://www.linovelib.com/novel/${ctx.params.id}/catalog`,
description: title,
language: 'zh',
item: items,
};
};
+13
View File
@@ -0,0 +1,13 @@
module.exports = {
'linovelib.com': {
_name: '哩哔轻小说',
'.': [
{
title: '小说详情',
docs: 'https://docs.rsshub.app/anime.html#linovelib',
source: ['/novel/:id'],
target: '/linovellib/novel/:id',
},
],
},
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/novel/:id', require('./novel'));
};