fix(route): 修复 王者荣耀 - 新闻列表 pubDate 的解析错误 (#10351)

* feat: 优化B站动态转发内容中的图片和视频

* style: 修复格式错误

* fix: 修复 B站动态转发多图的图片缺失

* style: 整理代码格式

* style: 整理代码格式

* fix: 修复B站动态转发视频缺失标题

* fix: 移除了部分不必要的代码

* fix: 修复b站动态中转发直播间动态出现undefined;整理部分代码

* style: 整理代码格式

* fix: 补充b站动态中转发活动的信息

* fix: 修正代码格式

* fix: b站动态转发专题页缺少标题;整理部分代码

* fix: 修复图片错误

* fix: 修复专栏封面缺失的bug;增加B站动态格式总结

* style:修复格式问题

* fix: 修复/robots.txt路由

* fix

* chore: 合并冲突

* fix

* fix

* feat: 优化B站动态url

* fix: 改 \n 为<br>

* chore: 更新 npm registry

* feat: 完成 米游社路由和文档的编写

* fix: 修复 @vuepress/shared-utils 在 yarn.lock 的缺失

* chore: exact match

* fix: parseDate

* feat(米游社v2): 新增 米游社v2 绝区零 公告

* fix: 修复 王者荣耀 - 新闻列表 pubDate 的解析错误

* refactor: migrate to v2

* docs: fix typo
This commit is contained in:
CaoMeiYouRen
2022-07-29 20:00:48 +08:00
committed by GitHub
parent 79e354593a
commit d7871687a2
6 changed files with 50 additions and 24 deletions
+20 -6
View File
@@ -693,7 +693,13 @@ Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547`
### 新闻中心
<Route author="Jeason0228 HenryQW" example="/tencent/pvp/newsindex/all" path="/tencent/pvp/newsindex/:type" :paramsDesc="['栏目分类,all=全部,rm=热门,xw=新闻,gg=公告,hd=活动,ss=赛事']"/>
<Route author="Jeason0228 HenryQW" example="/tencent/pvp/newsindex/all" path="/tencent/pvp/newsindex/:type" :paramsDesc="['栏目分类,见下表']">
| 全部 | 热门 | 新闻 | 公告 | 活动 | 赛事 | 优化 |
| --- | -- | -- | -- | -- | -- | -- |
| all | rm | xw | gg | hd | ss | yh |
</Route>
## 网易大神
@@ -713,7 +719,7 @@ Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547`
### 游戏折扣信息
<Route author="MyFaith" example="/xiaoheihe/discount/pc" path="xiaoheihe/discount/:platform?" :paramsDesc="['平台, 默认为Steam']">
<Route author="MyFaith" example="/xiaoheihe/discount/pc" path="xiaoheihe/discount/:platform?" :paramsDesc="['平台,默认为 Steam']">
| Steam | PlatStation4 | Switch |
| ----- | ------------ | ------ |
@@ -725,7 +731,13 @@ Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547`
### 新闻中心
<Route author="Jeason0228" example="/lol/newsindex/all" path="/lol/newsindex/:type" :paramsDesc="['栏目分类,all=全部,zh=综合,gg=公告,ss=赛事,gl=攻略,sq=社区']"/>
<Route author="Jeason0228" example="/lol/newsindex/all" path="/lol/newsindex/:type" :paramsDesc="['栏目分类,见下表']">
| 全部 | 综合 | 公告 | 赛事 | 攻略 | 社区 |
| --- | -- | -- | -- | -- | -- |
| all | zh | gg | ss | gl | sq |
</Route>
## 游民星空
@@ -760,16 +772,18 @@ Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547`
### 游戏资讯
<Route author="wy916787036" example="/vgn" path="/vgn/:platform?" :paramsDesc="['平台,见下表,默认为全部']">
| Switch | PS4 | PC | Xbox |
| -------- | -------- | -------- | -------- |
| 1 | 2 | 3 | 4 |
| ------ | --- | -- | ---- |
| 1 | 2 | 3 | 4 |
</Route>
## 游戏年轮
### 分类
<Route author="nczitzk" example="/bibgame/sgame" path="/bibgame/:category?/:type?" :paramsDesc="['分类,见下表,默认为PC游戏', '类型,可在各分类页中导航栏中找到']">
<Route author="nczitzk" example="/bibgame/sgame" path="/bibgame/:category?/:type?" :paramsDesc="['分类,见下表,默认为 PC 游戏', '类型,可在各分类页中导航栏中找到']">
| PC 游戏 | PS4 游戏 | Switch 游戏 | NS 其他板块 | galgame | VR 游戏 | 3DS 游戏 | psv 游戏 | xbox360 游戏 | ps3 游戏 | 其他掌机 |
| ------ | ------ | --------- | ------- | ------- | ----- | ------ | ------ | ---------- | ------ | ------- |
+1 -1
View File
@@ -1836,7 +1836,7 @@ router.get('/simonsfoundation/articles', lazyloadRouteHandler('./routes/simonsfo
router.get('/simonsfoundation/recommend', lazyloadRouteHandler('./routes/simonsfoundation/recommend'));
// 王者荣耀
router.get('/tencent/pvp/newsindex/:type', lazyloadRouteHandler('./routes/tencent/pvp/newsindex'));
// router.get('/tencent/pvp/newsindex/:type', lazyloadRouteHandler('./routes/tencent/pvp/newsindex'));
// 《明日方舟》游戏 (migrated to v2)
// router.get('/arknights/news', lazyloadRouteHandler('./routes/arknights/news'));
+2 -1
View File
@@ -1,4 +1,5 @@
module.exports = {
'/qq/sdk/changelog/:platform': ['nuomi1'],
'/cloud/column/:id?/:tag?': ['nczitzk'],
'/pvp/newsindex/:type': ['Jeason0228', 'HenryQW'],
'/qq/sdk/changelog/:platform': ['nuomi1'],
};
@@ -1,10 +1,12 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
const map = new Map([
['rm', { name: '热门', channelid: 1760 }],
['xw', { name: '新闻', channelid: 1761 }],
['gg', { name: '公告', channelid: 1762 }],
['hd', { name: '活动', channelid: 1763 }],
['ss', { name: '赛事', channelid: 1764 }],
['yh', { name: '优化', channelid: 1769 }],
['all', { name: '全部', channelid: 0 }],
]);
const link = 'https://pvp.qq.com/web201706/newsindex.shtml';
@@ -12,7 +14,7 @@ const apiUrl = 'https://apps.game.qq.com/wmp/v3.1/?p0=18&p1=searchNewsKeywordsLi
const pageUrl = `https://pvp.qq.com/web201706/newsdetail.shtml?tid=`;
const getPage = async (id, typeName) => {
const response = await got.get(apiUrl + id, {
const response = await got(apiUrl + id, {
headers: {
Referer: link,
},
@@ -20,16 +22,16 @@ const getPage = async (id, typeName) => {
return Promise.all(
response.data.msg.result.map(async (item) => {
let description = await got.get(`https://apps.game.qq.com/wmp/v3.1/public/searchNews.php?p0=18&source=web_pc&id=${item.iNewsId}`);
let description = await got(`https://apps.game.qq.com/wmp/v3.1/public/searchNews.php?p0=18&source=web_pc&id=${item.iNewsId}`);
description = JSON.parse(description.data.match(/(?<=var searchObj=).*(?<!;)/g));
return Promise.resolve({
return {
title: `【${typeName}】` + item.sTitle,
link: pageUrl + item.iNewsId,
pubDate: new Date(`${item.sTargetIdxTime} GMT`).toUTCString(),
pubDate: parseDate(item.sTargetIdxTime),
description: description.msg.sContent,
});
};
})
);
};
@@ -45,7 +47,7 @@ module.exports = async (ctx) => {
const results = await Promise.all(
Array.from(map).map(async (value) => {
const res = await getPage(value[1].channelid, value[1].name);
return Promise.resolve(res);
return res;
})
);
results.forEach((result) => (item = item.concat(result)));
+17 -9
View File
@@ -1,6 +1,18 @@
module.exports = {
'qq.com': {
_name: '腾讯',
egame: [
{
title: '企鹅电竞直播间',
docs: 'https://docs.rsshub.app/live.html#qi-e-dian-jing-zhi-bo-jian-kai-bo',
source: '/:id',
target: (params) => {
if (params.id.match(/^\d+$/)) {
return '/egameqq/room/:id';
}
},
},
],
'mp.weixin': [
{
title: '微信公众号栏目',
@@ -15,16 +27,12 @@ module.exports = {
target: (params, url) => `/wechat/mp/msgalbum/${new URL(url).searchParams.get('__biz')}/${new URL(url).searchParams.get('album_id')}`,
},
],
egame: [
pvp: [
{
title: '企鹅电竞直播间',
docs: 'https://docs.rsshub.app/live.html#qi-e-dian-jing-zhi-bo-jian-kai-bo',
source: '/:id',
target: (params) => {
if (params.id.match(/^\d+$/)) {
return '/egameqq/room/:id';
}
},
title: '王者荣耀 - 新闻中心',
docs: 'https://docs.rsshub.app/game.html#wang-zhe-rong-yao',
source: ['/web201706/*', '/'],
target: '/tencent/pvp/newsindex/all',
},
],
v: [
+2 -1
View File
@@ -1,4 +1,5 @@
module.exports = (router) => {
router.get('/qq/sdk/changelog/:platform', require('./qq/sdk/changelog'));
router.get('/cloud/column/:id?/:tag?', require('./cloud/column'));
router.get('/pvp/newsindex/:type', require('./pvp/newsindex'));
router.get('/qq/sdk/changelog/:platform', require('./qq/sdk/changelog'));
};