mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 14:07:54 +08:00
feat: add topys category (#2464)
This commit is contained in:
@@ -205,6 +205,12 @@ pageClass: routes
|
||||
|
||||
</Route>
|
||||
|
||||
## TOPYS
|
||||
|
||||
### 分类
|
||||
|
||||
<Route author="kt286" example="/topys/7" path="/topys/:category" :paramsDesc="['分类ID,可在对应页面的 URL 中找到']"/>
|
||||
|
||||
## TSSstatus(iOS 降级通道)
|
||||
|
||||
### Status
|
||||
|
||||
@@ -1427,6 +1427,9 @@ router.get('/aiyanxishe/:id/:sort?', require('./routes/aiyanxishe/home'));
|
||||
// 飞客茶馆优惠信息
|
||||
router.get('/flyertea/preferential', require('./routes/flyertea/preferential'));
|
||||
|
||||
// TOPYS
|
||||
router.get('/topys/:category', require('./routes/topys/article'));
|
||||
|
||||
// 巴比特作者专栏
|
||||
router.get('/8btc/:authorid', require('./routes/8btc/author'));
|
||||
|
||||
|
||||
56
lib/routes/topys/article.js
Normal file
56
lib/routes/topys/article.js
Normal file
@@ -0,0 +1,56 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category;
|
||||
const html = await got({
|
||||
method: 'get',
|
||||
url: `https://www.topys.cn/category/${category}.html`,
|
||||
headers: {
|
||||
referer: `https://www.topys.cn/category/${category}.html`,
|
||||
cookie: 'PHPSESSID=8gd6q9j2h0o6fpsl570ah3chg8; can_webp=true',
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(html.data);
|
||||
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
url: 'https://www.topys.cn/ajax/article/get_article_list',
|
||||
form: true,
|
||||
data: {
|
||||
needloginpage: 2,
|
||||
islogin: 0,
|
||||
module: 'article',
|
||||
column: category,
|
||||
timestape: $('#login-vue').attr('data-timestape'),
|
||||
token: $('#login-vue').attr('data-token'),
|
||||
offset: 0,
|
||||
size: 12,
|
||||
page: 0,
|
||||
type: 'column',
|
||||
need_count: true,
|
||||
},
|
||||
headers: {
|
||||
referer: `https://www.topys.cn/category/${category}.html`,
|
||||
cookie: 'PHPSESSID=8gd6q9j2h0o6fpsl570ah3chg8; can_webp=true',
|
||||
},
|
||||
});
|
||||
|
||||
const items = response.data.result.map((item) => {
|
||||
const single = {
|
||||
title: item.title,
|
||||
description: item.content,
|
||||
pubDate: new Date(item.app_push_time + '000').toUTCString(),
|
||||
link: `http://www.topys.cn/article/detail?id=${item.id}`,
|
||||
author: item.editor,
|
||||
};
|
||||
return single;
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'TOPYS | 全球顶尖创意分享平台 OPEN YOUR MIND',
|
||||
link: `https://www.topys.cn/category/${category}.html`,
|
||||
description: 'TOPYS | 全球顶尖创意分享平台 OPEN YOUR MIND',
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user