mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 05:59:00 +08:00
@@ -581,6 +581,10 @@ RSSHub 提供下列 API 接口:
|
||||
|
||||
<route name="粉絲專頁" author="maple3142" example="/facebook/page/SonetPCR" path="/facebook/page/:id" :paramsDesc="['專頁 id']"/>
|
||||
|
||||
### 币乎
|
||||
|
||||
<route name="用户动态" author="LogicJake" example="/bihu/people/activaties" path="/bihu/activaties/:id" :paramsDesc="['用户 id']"/>
|
||||
|
||||
## 编程
|
||||
|
||||
### 掘金
|
||||
|
||||
@@ -935,6 +935,9 @@ router.get('/shanbay/checkin/:id', require('./routes/shanbay/checkin'));
|
||||
// Facebook
|
||||
router.get('/facebook/page/:id', require('./routes/facebook/page'));
|
||||
|
||||
// 币乎
|
||||
router.get('/bihu/activaties/:id', require('./routes/bihu/activaties'));
|
||||
|
||||
// 停电通知
|
||||
router.get('/tingdiantz/95598/:orgNo/:provinceNo/:outageStartTime/:outageEndTime/:scope?', require('./routes/tingdiantz/95598'));
|
||||
router.get('/tingdiantz/95598/:orgNo/:provinceNo/:scope?', require('./routes/tingdiantz/95598'));
|
||||
|
||||
70
lib/routes/bihu/activaties.js
Normal file
70
lib/routes/bihu/activaties.js
Normal file
@@ -0,0 +1,70 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const url = require('url');
|
||||
|
||||
const api = 'https://be02.bihu.com/bihube-pc/bihu/user/getUserContentList/';
|
||||
const articleHost = 'https://bihu.com/article/';
|
||||
const host = 'https://bihu.com/people/';
|
||||
const getArticleApi = 'https://be02.bihu.com/bihube-pc/api/content/show/getArticle2/';
|
||||
const articleContent = 'https://oss02.bihu.com/';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const link = url.resolve(host, id);
|
||||
const response = await axios.post(api, {
|
||||
queryUserId: id,
|
||||
pageNum: 1,
|
||||
});
|
||||
|
||||
const data = response.data.data;
|
||||
const contenList = data.list;
|
||||
|
||||
let author = '未知用户';
|
||||
let out = '';
|
||||
|
||||
if (contenList.length !== 0) {
|
||||
author = contenList[0].userName;
|
||||
|
||||
out = await Promise.all(
|
||||
contenList.map(async (item) => {
|
||||
const type = item.type;
|
||||
let description = item.content;
|
||||
let title = '动态';
|
||||
let itemLink = link;
|
||||
|
||||
// 文章
|
||||
if (type !== 1) {
|
||||
title = item.title;
|
||||
const contentId = item.contentId;
|
||||
itemLink = url.resolve(articleHost, contentId.toString());
|
||||
|
||||
const getArticleApiResponse = await axios.post(getArticleApi, {
|
||||
artId: contentId,
|
||||
});
|
||||
|
||||
const articleContentPath = getArticleApiResponse.data.data.content;
|
||||
|
||||
const link = url.resolve(articleContent, articleContentPath);
|
||||
const articleContentResponse = await axios.get(link);
|
||||
description = decodeURIComponent(articleContentResponse.data);
|
||||
}
|
||||
|
||||
const single = {
|
||||
title: title,
|
||||
link: itemLink,
|
||||
author: author,
|
||||
description: description,
|
||||
pubDate: new Date(item.createTime),
|
||||
};
|
||||
|
||||
return single;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
ctx.state.data = {
|
||||
title: `币乎 - ${author}的动态`,
|
||||
link: link,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user