feat(route): 增加微语简报源 (#9577)

* 添加微语简报源

* 精简列表描述

* 优化微语简报排版,增加文档说明

* 修复部分序号错误问题

* 增加v2版微语简报源

* 时区修改

* 删除微语简报旧路由

* 按建议修改

* 修改微语简报网址
This commit is contained in:
x2009again 2022-04-21 23:18:35 +08:00 committed by GitHub
parent 0e91efee0b
commit 42dfd5cc81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 67 additions and 0 deletions

View File

@ -3995,3 +3995,9 @@ QueryString:
| | zh-hk | zh-tw |
</Route>
## 云奇网
### 微语简报
<Route author="x2009again" example="/yunspe/newsflash" path="/yunspe/newsflash" />

View File

@ -0,0 +1,3 @@
module.exports = {
'/newsflash': ['x2009again'],
};

View File

@ -0,0 +1,42 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
const timezone = require('@/utils/timezone');
module.exports = async (ctx) => {
const response = await got({
method: 'post',
url: 'https://www.yunspe.com/wp-json/b2/v1/getNewsflashesList',
headers: {
Referer: 'https://www.yunspe.com/newsflashes',
'content-type': 'application/x-www-form-urlencoded',
},
body: 'paged=1&term=0&post_paged=1',
});
const data = response.data.data;
const out = data.map((item) => {
const title = item[0].title.replace('【微语简报】', '');
const link = item[0].link;
const datematch = item[0]._date.match(/datetime="(.*)" itemprop/);
const date = datematch && datematch[1];
const description = item[0].content
.substring(item[0].content.indexOf('【今日简报】') + 6)
.replace(/(\d*\.\s)|(【)/g, '<br>$1$2')
.substring(4);
const single = {
title,
link,
pubDate: date && timezone(parseDate(date, 'YYYY-M-D H:mm:ss'), +8),
description,
};
return single;
});
ctx.state.data = {
title: '微语简报',
link: 'https://www.yunspe.com/newsflashes',
description: '微语简报',
item: out,
};
};

13
lib/v2/yunspe/radar.js Normal file
View File

@ -0,0 +1,13 @@
module.exports = {
'yunspe.com': {
_name: '云奇网',
'.': [
{
title: '微语简报',
docs: 'https://docs.rsshub.app/new-media.html#wei-yu-jian-bao',
source: ['/newsflashes/微语简报', '/newsflashes', '/'],
target: '/yunspe/newsflashes',
},
],
},
};

3
lib/v2/yunspe/router.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/newsflash', require('./newsflash'));
};