mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 06:30:40 +08:00
增加:轻小说文库 (#1515)
This commit is contained in:
@@ -2409,6 +2409,10 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的
|
||||
|
||||
<route name="Poems" author="HenryQW" example="/allpoetry/newest" path="/allpoetry/:order?" :paramsDesc="['排序方式, `best` 或 `newest`, 缺省 `best`']"/>
|
||||
|
||||
### 轻小说文库
|
||||
|
||||
<route name="章节" author="zsakvo" example="/wenku8/chapter/74" path="/wenku8/chapter/:id" :paramsDesc="['小说 id, 可在对应小说页 URL 中找到']"/>
|
||||
|
||||
## 中国驻外使领馆
|
||||
|
||||
### 大使馆
|
||||
|
||||
@@ -1019,4 +1019,7 @@ router.get('/jpmorganchase', require('./routes/jpmorganchase/research'));
|
||||
// 美拍
|
||||
router.get('/meipai/user/:uid', require('./routes/meipai/user'));
|
||||
|
||||
// 轻小说文库
|
||||
router.get('/wenku8/chapter/:id', require('./routes/wenku8/chapter'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
35
lib/routes/wenku8/chapter.js
Normal file
35
lib/routes/wenku8/chapter.js
Normal file
@@ -0,0 +1,35 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const iconv = require('iconv-lite');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const index = parseInt(id / 1000);
|
||||
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: `https://www.wenku8.net/novel/${index}/${id}/index.htm`,
|
||||
responseType: 'arraybuffer',
|
||||
});
|
||||
|
||||
const responseHtml = iconv.decode(response.data, 'gbk');
|
||||
|
||||
const $ = cheerio.load(responseHtml);
|
||||
|
||||
const name = $('#title').text();
|
||||
|
||||
const chapter_item = [];
|
||||
|
||||
$('.ccss>a').each(function() {
|
||||
chapter_item.push({
|
||||
title: $(this).text(),
|
||||
link: `https://www.wenku8.net/novel/${index}/${id}/` + $(this).attr('href'),
|
||||
});
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: `轻小说文库 ${name}`,
|
||||
link: `https://www.wenku8.net/book/${id}.htm`,
|
||||
item: chapter_item,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user