From d7871687a272c80b156d8e2ed1532d5b11e013ca Mon Sep 17 00:00:00 2001 From: CaoMeiYouRen <40430746+CaoMeiYouRen@users.noreply.github.com> Date: Fri, 29 Jul 2022 20:00:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(route):=20=E4=BF=AE=E5=A4=8D=20=E7=8E=8B?= =?UTF-8?q?=E8=80=85=E8=8D=A3=E8=80=80=20-=20=E6=96=B0=E9=97=BB=E5=88=97?= =?UTF-8?q?=E8=A1=A8=20pubDate=20=E7=9A=84=E8=A7=A3=E6=9E=90=E9=94=99?= =?UTF-8?q?=E8=AF=AF=20(#10351)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 为
* 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 --- docs/game.md | 26 ++++++++++++++++----- lib/router.js | 2 +- lib/v2/tencent/maintainer.js | 3 ++- lib/{routes => v2}/tencent/pvp/newsindex.js | 14 ++++++----- lib/v2/tencent/radar.js | 26 ++++++++++++++------- lib/v2/tencent/router.js | 3 ++- 6 files changed, 50 insertions(+), 24 deletions(-) rename lib/{routes => v2}/tencent/pvp/newsindex.js (84%) diff --git a/docs/game.md b/docs/game.md index 2c3029b1dd..a8de4e39d7 100644 --- a/docs/game.md +++ b/docs/game.md @@ -693,7 +693,13 @@ Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547` ### 新闻中心 - + + +| 全部 | 热门 | 新闻 | 公告 | 活动 | 赛事 | 优化 | +| --- | -- | -- | -- | -- | -- | -- | +| all | rm | xw | gg | hd | ss | yh | + + ## 网易大神 @@ -713,7 +719,7 @@ Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547` ### 游戏折扣信息 - + | Steam | PlatStation4 | Switch | | ----- | ------------ | ------ | @@ -725,7 +731,13 @@ Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547` ### 新闻中心 - + + +| 全部 | 综合 | 公告 | 赛事 | 攻略 | 社区 | +| --- | -- | -- | -- | -- | -- | +| all | zh | gg | ss | gl | sq | + + ## 游民星空 @@ -760,16 +772,18 @@ Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547` ### 游戏资讯 + | Switch | PS4 | PC | Xbox | -| -------- | -------- | -------- | -------- | -| 1 | 2 | 3 | 4 | +| ------ | --- | -- | ---- | +| 1 | 2 | 3 | 4 | + ## 游戏年轮 ### 分类 - + | PC 游戏 | PS4 游戏 | Switch 游戏 | NS 其他板块 | galgame | VR 游戏 | 3DS 游戏 | psv 游戏 | xbox360 游戏 | ps3 游戏 | 其他掌机 | | ------ | ------ | --------- | ------- | ------- | ----- | ------ | ------ | ---------- | ------ | ------- | diff --git a/lib/router.js b/lib/router.js index 3da1d79a99..a115feb2b3 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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')); diff --git a/lib/v2/tencent/maintainer.js b/lib/v2/tencent/maintainer.js index c8eaa0ce0a..912c121af9 100644 --- a/lib/v2/tencent/maintainer.js +++ b/lib/v2/tencent/maintainer.js @@ -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'], }; diff --git a/lib/routes/tencent/pvp/newsindex.js b/lib/v2/tencent/pvp/newsindex.js similarity index 84% rename from lib/routes/tencent/pvp/newsindex.js rename to lib/v2/tencent/pvp/newsindex.js index 2849b976c7..58f2e64850 100644 --- a/lib/routes/tencent/pvp/newsindex.js +++ b/lib/v2/tencent/pvp/newsindex.js @@ -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=).*(? { 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))); diff --git a/lib/v2/tencent/radar.js b/lib/v2/tencent/radar.js index afbe48b6a0..cb806a3286 100644 --- a/lib/v2/tencent/radar.js +++ b/lib/v2/tencent/radar.js @@ -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: [ diff --git a/lib/v2/tencent/router.js b/lib/v2/tencent/router.js index 46f91af6fa..fc686be3eb 100644 --- a/lib/v2/tencent/router.js +++ b/lib/v2/tencent/router.js @@ -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')); };