feat(route): add route for Ke Research Institute (#11714)

* feat(route): add route for Ke Research Institute

Signed-off-by: shaomingbo <shaomingbo@hotmail.com>

* Update lib/v2/ke/results.js

refactor: replace string template to normal string

* Update lib/v2/ke/results.js

refactor: replace string template to normal string

* refactor: docs format

Signed-off-by: shaomingbo <shaomingbo@hotmail.com>

* Update lib/v2/ke/results.js

---------

Signed-off-by: shaomingbo <shaomingbo@hotmail.com>
This commit is contained in:
shaomingbo
2023-01-29 22:13:26 +08:00
committed by GitHub
parent e9d5d3555f
commit 6aa42e2cf1
5 changed files with 61 additions and 0 deletions
+6
View File
@@ -1003,3 +1003,9 @@ type 为 all 时,category 参数不支持 cost 和 free
### はてな匿名ダイアリー - 人気記事アーカイブ
<Route author="masakichi" example="/hatena/anonymous_diary/archive" path="/hatena/anonymous_diary/archive"/>
## 贝壳研究院
### 研究成果
<Route author="shaomingbo" example="/ke/researchResults" path="/ke/researchResults" radar="1"/>
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
'/researchResults': ['shaomingbo'],
};
+13
View File
@@ -0,0 +1,13 @@
module.exports = {
'research.ke.com': {
_name: '贝壳研究院 - 房地产行业研究报告',
www: [
{
title: '研究成果',
docs: 'https://docs.rsshub.app/other.html#bei-ke-yan-jiu-yuan',
source: ['/researchResults'],
target: '/researchResults',
},
],
},
};
+36
View File
@@ -0,0 +1,36 @@
const { parseDate } = require('@/utils/parse-date');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const response = await got({
method: 'post',
url: 'https://research.ke.com/apis/consumer-access/index/contents/page',
headers: {
Referer: 'https://research.ke.com/ResearchResults',
},
json: {
pageIndex: 1,
pageSize: 9,
},
});
const { status, statusMessage } = response;
if (status !== 200) {
throw new Error(statusMessage);
}
const { list } = response.data.data;
ctx.state.data = {
title: '房地产行业研究报告',
link: 'https://research.ke.com/ResearchResults',
description: '研究成果',
item: list.map((item) => ({
title: item.title,
link: `https://research.ke.com/${item.contentTypeId}/ArticleDetail?id=${item.id}`,
author: item.author,
description: item.guideReading,
pubDate: parseDate(item.publishTime),
})),
};
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/researchResults', require('./results'));
};