mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-16 02:42:57 +08:00
feat: 观察者个人主页 、装备前线 RSS (#3251)
This commit is contained in:
@@ -289,6 +289,10 @@ pageClass: routes
|
|||||||
|
|
||||||
<Route author="occupy5" example="/guanchazhe/topic/113" path="/guanchazhe/topic/:id" :paramsDesc="['话题id, 可在URL中找到']" />
|
<Route author="occupy5" example="/guanchazhe/topic/113" path="/guanchazhe/topic/:id" :paramsDesc="['话题id, 可在URL中找到']" />
|
||||||
|
|
||||||
|
### 个人主页文章
|
||||||
|
|
||||||
|
<Route author="Jeason0228" example="/guanchazhe/personalpage/243983" path="/guanchazhe/personalpage/:uid" :paramsDesc="['用户id, 可在URL中找到']" />
|
||||||
|
|
||||||
## 果壳网
|
## 果壳网
|
||||||
|
|
||||||
### 科学人
|
### 科学人
|
||||||
@@ -431,6 +435,12 @@ pageClass: routes
|
|||||||
|
|
||||||
<Route author="WenryXu" example="/juesheng" path="/juesheng"/>
|
<Route author="WenryXu" example="/juesheng" path="/juesheng"/>
|
||||||
|
|
||||||
|
## 装备前线
|
||||||
|
|
||||||
|
### 首页最新帖子
|
||||||
|
|
||||||
|
<Route author="Jeason0228" example="/zfrontier/postlist/:byReplyTime" path="/zfrontier/postlist" :paramsDesc="['内容标签, 点击标签后地址栏有显示']"/>
|
||||||
|
|
||||||
## 快科技(原驱动之家)
|
## 快科技(原驱动之家)
|
||||||
|
|
||||||
### 最新新闻
|
### 最新新闻
|
||||||
|
|||||||
@@ -1395,8 +1395,12 @@ router.get('/boc/whpj/:format?', require('./routes/boc/whpj'));
|
|||||||
// 漫画db
|
// 漫画db
|
||||||
router.get('/manhuadb/comics/:id', require('./routes/manhuadb/comics'));
|
router.get('/manhuadb/comics/:id', require('./routes/manhuadb/comics'));
|
||||||
|
|
||||||
|
// 装备前线
|
||||||
|
router.get('/zfrontier/postlist/:type', require('./routes/zfrontier/postlist'));
|
||||||
|
|
||||||
// 观察者风闻话题
|
// 观察者风闻话题
|
||||||
router.get('/guanchazhe/topic/:id', require('./routes/guanchazhe/topic'));
|
router.get('/guanchazhe/topic/:id', require('./routes/guanchazhe/topic'));
|
||||||
|
router.get('/guanchazhe/personalpage/:uid', require('./routes/guanchazhe/personalpage'));
|
||||||
|
|
||||||
// Hpoi 手办维基
|
// Hpoi 手办维基
|
||||||
router.get('/hpoi/info/:type?', require('./routes/hpoi/info'));
|
router.get('/hpoi/info/:type?', require('./routes/hpoi/info'));
|
||||||
|
|||||||
38
lib/routes/guanchazhe/personalpage.js
Normal file
38
lib/routes/guanchazhe/personalpage.js
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const uid = ctx.params.uid;
|
||||||
|
const host = 'https://user.guancha.cn';
|
||||||
|
const link = `https://app.guancha.cn/user/get-published-list?page_size=20&page_no=1&uid=${uid}`;
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: link,
|
||||||
|
headers: {
|
||||||
|
Referer: host,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const list = response.data.data.items;
|
||||||
|
const user_nick = list[0].user_nick;
|
||||||
|
function getpass_at(e) {
|
||||||
|
// 修复数据返回缺少年份 但是 几个小时前的就不想写了 = =
|
||||||
|
if (e.length === 11) {
|
||||||
|
const now = new Date();
|
||||||
|
const year = now.getFullYear();
|
||||||
|
e = year + '-' + e;
|
||||||
|
}
|
||||||
|
const time = new Date(e).toLocaleString();
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${user_nick}-观察者-风闻社区`,
|
||||||
|
link: link,
|
||||||
|
description: `${user_nick} 的个人主页`,
|
||||||
|
item: list.map((item) => ({
|
||||||
|
title: item.title,
|
||||||
|
description: `${item.summary}`,
|
||||||
|
pubDate: getpass_at(item.pass_at),
|
||||||
|
link: `https://user.guancha.cn/main/content?id=${item.id}`,
|
||||||
|
author: item.user_nick,
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
};
|
||||||
32
lib/routes/zfrontier/postlist.js
Normal file
32
lib/routes/zfrontier/postlist.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const type = ctx.params.type || 'byReplyTime';
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: `https://www.zfrontier.com/?sort=${type}&page=1`,
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = response.data;
|
||||||
|
const $ = cheerio.load(data);
|
||||||
|
const list = $('.post-entry');
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${type}贴子列表 - zFrontier装备前线`,
|
||||||
|
link: response.url,
|
||||||
|
description: 'zFrontier 发烧友的最前线',
|
||||||
|
item:
|
||||||
|
list &&
|
||||||
|
list
|
||||||
|
.map((index, item) => {
|
||||||
|
item = $(item);
|
||||||
|
return {
|
||||||
|
title: `${item.find('.post-title h2').text()}`,
|
||||||
|
description: `${item.find('.ellipsis').html()}<br/>${item.find('.imgs-wrap').html()}`,
|
||||||
|
link: `https://www.zfrontier.com${item.find('.post-title').attr('href')}`,
|
||||||
|
pubDate: new Date(item.find('.time').text()).toLocaleDateString(),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.get(),
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user