mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 14:40:23 +08:00
feat: 增加小说-飘天文学 (#3765)
This commit is contained in:
@@ -106,6 +106,16 @@ pageClass: routes
|
||||
|
||||
</Route>
|
||||
|
||||
## 飘天文学
|
||||
|
||||
### 章节
|
||||
|
||||
<Route author="LJason77" example="/novel/ptwxz/10/10272" path="/novel/ptwxz/:id1/:id2" :paramsDesc="['小说网站链接倒数第二部分的数字, 可在对应小说页 URL 中找到, 例如 `10`', '小说网站链接最后的数字, 可在对应小说页 URL 中找到, 例如 `10272`']" >
|
||||
|
||||
举例网址:https://www.ptwxz.com/bookinfo/10/10272.html
|
||||
|
||||
</Route>
|
||||
|
||||
## 起点
|
||||
|
||||
### 章节
|
||||
|
||||
@@ -518,6 +518,7 @@ router.get('/novel/uukanshu/:uid', require('./routes/novel/uukanshu'));
|
||||
router.get('/novel/wenxuemi/:id1/:id2', require('./routes/novel/wenxuemi'));
|
||||
router.get('/novel/booksky/:id', require('./routes/novel/booksky'));
|
||||
router.get('/novel/shuquge/:id', require('./routes/novel/shuquge'));
|
||||
router.get('/novel/ptwxz/:id1/:id2', require('./routes/novel/ptwxz'));
|
||||
|
||||
// 中国气象网
|
||||
router.get('/weatheralarm', require('./routes/weatheralarm'));
|
||||
|
||||
47
lib/routes/novel/ptwxz.js
Normal file
47
lib/routes/novel/ptwxz.js
Normal file
@@ -0,0 +1,47 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const iconv = require('iconv-lite');
|
||||
|
||||
const baseUrl = 'https://www.ptwxz.com/bookinfo/';
|
||||
|
||||
// 获取小说的最新章节列表
|
||||
module.exports = async (ctx) => {
|
||||
// 小说id
|
||||
const id1 = ctx.params.id1;
|
||||
const id2 = ctx.params.id2;
|
||||
const id = id1 + '/' + id2;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `${baseUrl}${id}.html`,
|
||||
headers: {
|
||||
Referer: `${baseUrl}${id}.html`,
|
||||
},
|
||||
responseType: 'buffer',
|
||||
});
|
||||
const responseHtml = iconv.decode(response.data, 'gbk');
|
||||
const $ = cheerio.load(responseHtml);
|
||||
|
||||
const title = $('span>h1').text();
|
||||
|
||||
const list = $('.grid>tbody>tr>td>li>a');
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${title}`,
|
||||
link: `${baseUrl}${id}.html`,
|
||||
description: '',
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
|
||||
return {
|
||||
title: item[0].children[0].data,
|
||||
description: '',
|
||||
link: item.attr('href'),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user