feat(route): Add wmpvp (#14586)
This commit is contained in:
parent
1badc67a6a
commit
0a9f1f8067
|
|
@ -0,0 +1,34 @@
|
|||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { type } = ctx.params;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://appengine.wmpvp.com/steamcn/community/homepage/getHomeInformation?gameTypeStr=${type}&pageNum=1&pageSize=20`,
|
||||
});
|
||||
const data = response.data.result.filter((item) => item.news !== undefined);
|
||||
|
||||
const items = data.map((item) => {
|
||||
const entity = item.news;
|
||||
const newsId = entity.newsId;
|
||||
const newsLink = `https://news.wmpvp.com/news.html?id=${newsId}&gameTypeStr=${type}`;
|
||||
|
||||
// 最终需要返回的对象
|
||||
return {
|
||||
title: entity.title,
|
||||
pubDate: parseDate(entity.publishTime),
|
||||
link: newsLink,
|
||||
guid: newsLink,
|
||||
description: entity.summary,
|
||||
author: entity.author,
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: `完美世界电竞`,
|
||||
link: `https://news.wmpvp.com/`,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/news/:type': ['tssujt'],
|
||||
};
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
module.exports = {
|
||||
'wmpvp.com': {
|
||||
_name: '完美世界电竞',
|
||||
'.': [
|
||||
{
|
||||
title: '资讯',
|
||||
docs: 'https://docs.rsshub.app/routes/game#wan-mei-shi-jie-dian-jing-zi-xun',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/news/:type', require('.'));
|
||||
};
|
||||
|
|
@ -903,6 +903,16 @@ Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547`
|
|||
|
||||
<Route author="luyuhuang" example="/163/ds/63dfbaf4117741daaf73404601165843" path="/163/ds/:id" paramsDesc={['用户ID']} />
|
||||
|
||||
## 完美世界电竞 {#wan-mei-shi-jie-dian-jing}
|
||||
|
||||
### 资讯列表 {#wan-mei-shi-jie-dian-jing-zi-xun}
|
||||
|
||||
<Route author="tssujt" example="/wmpvp/news/1" path="/wmpvp/news/:type" paramsDesc={['资讯分类,见下表']}>
|
||||
| DOTA2 | CS2 |
|
||||
| ---- | ---- |
|
||||
| 1 | 2 |
|
||||
</Route>
|
||||
|
||||
## 小黑盒 {#xiao-hei-he}
|
||||
|
||||
### 用户动态 {#xiao-hei-he-yong-hu-dong-tai}
|
||||
|
|
|
|||
Loading…
Reference in New Issue