mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 06:30:40 +08:00
feat: add pintu360
This commit is contained in:
@@ -1324,3 +1324,17 @@ type 为 all 时,category 参数不支持 cost 和 free
|
||||
### 全文
|
||||
|
||||
<Route author="HenryQW" example="/zzz" path="/zzz/index"/>
|
||||
|
||||
## 品途商业评论
|
||||
|
||||
### 文章
|
||||
|
||||
<Route author="DIYgod" example="/pintu360/0" path="/pintu360/:type?" :paramsDesc="['类型, 默认为 `0` 推荐']">
|
||||
|
||||
类型
|
||||
|
||||
| 推荐 | 零售前沿 | 智能科技 | 泛文娱 | 教育 | 大健康 | 新消费 | 创业投资 |
|
||||
| ---- | -------- | -------- | ------ | ---- | ------ | ------ | -------- |
|
||||
| 0 | 7 | 10 | 9 | 98 | 70 | 8 | 72 |
|
||||
|
||||
</Route>
|
||||
|
||||
@@ -1704,4 +1704,7 @@ router.get('/nfmovies/:id?', require('./routes/nfmovies/index'));
|
||||
// 书友社区
|
||||
router.get('/andyt/:view?', require('./routes/andyt/index'));
|
||||
|
||||
// 品途商业评论
|
||||
router.get('/pintu360/:type?', require('./routes/pintu360/index'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
55
lib/routes/pintu360/index.js
Normal file
55
lib/routes/pintu360/index.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type || '0';
|
||||
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
url: 'https://www.pintu360.com/service/ajax_article_service.php',
|
||||
headers: {
|
||||
Referer: 'https://www.pintu360.com/',
|
||||
},
|
||||
form: true,
|
||||
data: {
|
||||
fnName: 'getArticleList',
|
||||
type: type === '0' ? 'recommend' : 'classId',
|
||||
id: type,
|
||||
pageNumber: 0,
|
||||
duration: 'quarter',
|
||||
},
|
||||
});
|
||||
const data = response.data;
|
||||
|
||||
const items = await Promise.all(
|
||||
data.slice(0, 10).map(async (item) => {
|
||||
const link = `https://www.pintu360.com/a${item.id}.html?${item.op}`;
|
||||
return Promise.resolve({
|
||||
title: item.title,
|
||||
description: await ctx.cache.tryGet(link, async () => {
|
||||
const res = await got(link);
|
||||
const $ = cheerio.load(res.data);
|
||||
return $('.article-content .text').html();
|
||||
}),
|
||||
pubDate: new Date(item.createTime).toUTCString(),
|
||||
link,
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
const titleMap = {
|
||||
'0': '推荐',
|
||||
'7': '零售前沿',
|
||||
'10': '智能科技',
|
||||
'9': '泛文娱',
|
||||
'98': '教育',
|
||||
'70': '大健康',
|
||||
'8': '新消费',
|
||||
'72': '创业投资',
|
||||
};
|
||||
ctx.state.data = {
|
||||
title: `品途商业评论-${titleMap[type]}`,
|
||||
link: type === '0' ? 'https://www.pintu360.com/' : `https://www.pintu360.com/articleList-${type}.html`,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user