add PlayStation Store list
This commit is contained in:
+10
-2
@@ -1,4 +1,4 @@
|
||||
# 游戏资讯
|
||||
# 游戏
|
||||
|
||||
## 3DMGame
|
||||
|
||||
@@ -100,7 +100,7 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的
|
||||
|
||||
## 游研社
|
||||
|
||||
<Route name="游研社" author="LightStrawberry" example="/yystv/category/:category" path="/yystv/category/:category" :paramsDesc="['专栏类型']"/>
|
||||
<Route name="游研社" author="LightStrawberry" example="/yystv/category/:category" path="/yystv/category/:category" :paramsDesc="['专栏类型']">
|
||||
|
||||
| 推游 | 游戏史 | 大事件 | 文化 | 趣闻 | 经典回顾 |
|
||||
| --------- | ------- | ------ | ------- | ---- | -------- |
|
||||
@@ -115,3 +115,11 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的
|
||||
<Route name="数折-折扣信息推送" author="LightStrawberry" example="/psnine/shuzhe" path="/psnine/shuzhe"/>
|
||||
<Route name="闲游-二手盘信息" author="LightStrawberry" example="/psnine/trade" path="/psnine/trade"/>
|
||||
<Route name="游戏-新游戏奖杯信息" author="LightStrawberry" example="/psnine/game" path="/psnine/game"/>
|
||||
|
||||
## PlayStation Store
|
||||
|
||||
<Route name="游戏列表" author="DIYgod" example="/ps/list/STORE-MSF86012-PLUS_FTT_CONTENT" path="/ps/list/:gridName" :paramsDesc="['列表的 grid 名']">
|
||||
|
||||
适用于 URL 如 <https://store.playstation.com/zh-hans-hk/grid/STORE-MSF86012-PLUS_FTT_CONTENT> 的列表页,比如 [PSN 每月免费游戏](https://store.playstation.com/zh-hans-hk/grid/STORE-MSF86012-PLUS_FTT_CONTENT) 的 gridName 为 STORE-MSF86012-PLUS_FTT_CONTENT
|
||||
|
||||
</Route>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# 待分类
|
||||
# 其他
|
||||
|
||||
## 自如
|
||||
|
||||
|
||||
@@ -1279,4 +1279,7 @@ router.get('/gaoqingla/:tag?', require('./routes/gaoqingla/latest'));
|
||||
// 马良行
|
||||
router.get('/mlhang', require('./routes/mlhang/latest'));
|
||||
|
||||
// PlayStation Store
|
||||
router.get('/ps/list/:gridName', require('./routes/ps/list'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
const axios = require('../../utils/axios');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const gridName = ctx.params.gridName;
|
||||
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: `https://store.playstation.com/valkyrie-api/zh/HK/19/container/${gridName}?size=30&bucket=games&start=0`,
|
||||
headers: {
|
||||
Referer: `https://store.playstation.com/zh-hans-hk/grid/${gridName}/1`,
|
||||
},
|
||||
});
|
||||
const data = response.data;
|
||||
const items = data.included && data.included.filter((item, index) => index % 2);
|
||||
const sub = data.included && data.included.filter((item, index) => !(index % 2));
|
||||
|
||||
ctx.state.data = {
|
||||
title: `PlayStation Store - ${data.data.attributes.name}`,
|
||||
link: `https://store.playstation.com/zh-hans-hk/grid/${gridName}/1`,
|
||||
item:
|
||||
items &&
|
||||
items.map((item, index) => ({
|
||||
title: `${item.attributes.name} (${sub[index].attributes.name})`,
|
||||
description: `大小:${item.attributes['file-size'].value}${item.attributes['file-size'].unit}<br><br>设备:${item.attributes.platforms.join(', ')}<br><br>类型:${item.attributes.genres.join(', ')}<br><br>评分:${
|
||||
item.attributes['star-rating'].score
|
||||
}<br><br>描述:${item.attributes['long-description']}<br><br>预览:${
|
||||
item.attributes['media-list'] && item.attributes['media-list'].preview && item.attributes['media-list'].preview[0] && item.attributes['media-list'].preview[0].url
|
||||
? `<video src="${item.attributes['media-list'].preview[0].url}" controls="controls" style="width: 100%"></video>`
|
||||
: '无'
|
||||
}`,
|
||||
link: `https://store.playstation.com/zh-hans-hk/product/${item.id}`,
|
||||
})),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user