parent
09a616d2b8
commit
fb82a648a4
|
|
@ -129,6 +129,8 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
|||
- Popular Recent Posts
|
||||
- 纽约时报
|
||||
- 新闻早报
|
||||
- UU 看书
|
||||
- 小说章节
|
||||
|
||||
## 鸣谢
|
||||
|
||||
|
|
|
|||
|
|
@ -1046,3 +1046,13 @@ language,语言,可在 [Trending 页](https://github.com/trending/javascript
|
|||
路由: `/nytimes/morning_post`
|
||||
|
||||
参数: 无
|
||||
|
||||
## UU 看书
|
||||
|
||||
### 小说章节
|
||||
|
||||
举例: [https://rsshub.app/uukanshu/chapter/49621](https://rsshub.app/uukanshu/chapter/49621)
|
||||
|
||||
路由: `/uukanshu/chapter/:id`
|
||||
|
||||
参数: id,小说 id,可在对应小说页 URL 中找到
|
||||
|
|
|
|||
|
|
@ -278,4 +278,7 @@ router.get('/yande.re/post/popular_recent/:period', require('./routes/yande.re/p
|
|||
// nytimes
|
||||
router.get('/nytimes/morning_post', require('./routes/nytimes/morning_post'));
|
||||
|
||||
// uukanshu
|
||||
router.get('/uukanshu/chapter/:uid', require('./routes/uukanshu/chapter'));
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
const iconv = require('iconv-lite');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const uid = ctx.params.uid;
|
||||
|
||||
const response = await axios({
|
||||
method: 'post',
|
||||
url: `https://www.uukanshu.com/b/${uid}`,
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
Referer: 'https://www.uukanshu.com/b/${uid}',
|
||||
},
|
||||
responseType: 'arraybuffer',
|
||||
});
|
||||
|
||||
const data = iconv.decode(response.data, 'gb2312');
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
const name = $('.jieshao_content>h1>a').text();
|
||||
const list = $('#chapterList li a');
|
||||
const cover_url = $('.bookImg>img').attr('src');
|
||||
const chapter_item = [];
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const el = $(list[i]);
|
||||
const item = {
|
||||
title: el.text(),
|
||||
link: `https://www.uukanshu.com${el.attr('href')}`,
|
||||
};
|
||||
chapter_item.push(item);
|
||||
}
|
||||
ctx.state.data = {
|
||||
title: `UU看书 ${name}`,
|
||||
link: `https://www.uukanshu.com/b/${uid}`,
|
||||
description: $('.jieshao_content h3').text(),
|
||||
image: cover_url,
|
||||
item: chapter_item,
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue