PlayStation Monthly Games
This commit is contained in:
@@ -52,17 +52,6 @@
|
||||
],
|
||||
},
|
||||
'www.chicagotribune.com': { _name: 'Chicago Tribune', www: [{ title: 'Chicago Tribune', docs: 'https://docs.rsshub.app/routes/traditional_media#chicago-tribune', source: '/' }] },
|
||||
'playstation.com': {
|
||||
_name: 'PlayStation',
|
||||
store: [
|
||||
{ title: '游戏列表', docs: 'https://docs.rsshub.app/routes/game#playstation', source: '/zh-hans-hk/grid/:id/:page', target: '/ps/list/:id' },
|
||||
{ title: '折扣|价格', docs: 'https://docs.rsshub.app/routes/game#playstation', source: ['/:lang/product/:gridName'], target: '/ps/:lang/product/:gridName' },
|
||||
],
|
||||
www: [
|
||||
{ title: '用户奖杯', docs: 'https://docs.rsshub.app/routes/game#playstation' },
|
||||
{ title: '系统更新纪录', docs: 'https://docs.rsshub.app/routes/game#playstation' },
|
||||
],
|
||||
},
|
||||
'monsterhunter.com': {
|
||||
_name: '怪物猎人世界',
|
||||
www: [
|
||||
|
||||
@@ -66,33 +66,6 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
},
|
||||
'playstation.com': {
|
||||
_name: 'PlayStation',
|
||||
store: [
|
||||
{
|
||||
title: '游戏列表',
|
||||
docs: 'https://docs.rsshub.app/routes/game#playstation',
|
||||
source: '/zh-hans-hk/grid/:id/:page',
|
||||
target: '/ps/list/:id',
|
||||
},
|
||||
{
|
||||
title: '折扣|价格',
|
||||
docs: 'https://docs.rsshub.app/routes/game#playstation',
|
||||
source: ['/:lang/product/:gridName'],
|
||||
target: '/ps/:lang/product/:gridName',
|
||||
},
|
||||
],
|
||||
www: [
|
||||
{
|
||||
title: '用户奖杯',
|
||||
docs: 'https://docs.rsshub.app/routes/game#playstation',
|
||||
},
|
||||
{
|
||||
title: '系统更新纪录',
|
||||
docs: 'https://docs.rsshub.app/routes/game#playstation',
|
||||
},
|
||||
],
|
||||
},
|
||||
'monsterhunter.com': {
|
||||
_name: '怪物猎人世界',
|
||||
www: [
|
||||
|
||||
@@ -638,12 +638,6 @@ router.get('/bupt/funbox', lazyloadRouteHandler('./routes/universities/bupt/funb
|
||||
// 广东海洋大学
|
||||
router.get('/gdoujwc', lazyloadRouteHandler('./routes/universities/gdou/jwc/jwtz'));
|
||||
|
||||
// PlayStation Store
|
||||
router.get('/ps/list/:gridName', lazyloadRouteHandler('./routes/ps/list'));
|
||||
router.get('/ps/trophy/:id', lazyloadRouteHandler('./routes/ps/trophy'));
|
||||
router.get('/ps/ps4updates', lazyloadRouteHandler('./routes/ps/ps4updates'));
|
||||
router.get('/ps/:lang?/product/:gridName', lazyloadRouteHandler('./routes/ps/product'));
|
||||
|
||||
// Quanta Magazine
|
||||
router.get('/quantamagazine/archive', lazyloadRouteHandler('./routes/quantamagazine/archive'));
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const gridName = ctx.params.gridName;
|
||||
|
||||
const response = await got({
|
||||
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}`,
|
||||
})),
|
||||
};
|
||||
};
|
||||
@@ -1,133 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
const dayjs = require('dayjs');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { gridName, lang } = ctx.params;
|
||||
|
||||
// 默认语言
|
||||
let langurl = 'zh/HK';
|
||||
let textshow = {
|
||||
tprice: `价格`,
|
||||
tdiscount: `优惠`,
|
||||
tplusfree: `PLUS 免费`,
|
||||
tendtime: `此优惠仅限`,
|
||||
endtimeformat: `YYYY.MM.DD h.mm A`,
|
||||
treleasedate: `发行日期`,
|
||||
releasedateformat: `YYYY.MM.DD`,
|
||||
tsize: `大小`,
|
||||
tdevice: `设备`,
|
||||
ttype: `类型`,
|
||||
trating: `评分`,
|
||||
tdescribe: `描述`,
|
||||
tpreview: `预览`,
|
||||
tnopreview: `无`,
|
||||
};
|
||||
// 繁体
|
||||
if (lang === 'zh-hant-hk') {
|
||||
langurl = `ch/HK`;
|
||||
}
|
||||
if (lang === 'zh-hant-tw') {
|
||||
langurl = `ch/TW`;
|
||||
}
|
||||
if (lang.indexOf('hant')) {
|
||||
textshow = {
|
||||
tprice: `價格`,
|
||||
tdiscount: `優惠`,
|
||||
tplusfree: `PLUS 免費`,
|
||||
tendtime: `此優惠僅限`,
|
||||
endtimeformat: `YYYY.MM.DD h.mm A`,
|
||||
treleasedate: `發售日`,
|
||||
releasedateformat: `YYYY.MM.DD`,
|
||||
tsize: `檔案大小`,
|
||||
tdevice: `播放裝置`,
|
||||
ttype: `類型`,
|
||||
trating: `評價`,
|
||||
tdescribe: `描述`,
|
||||
tpreview: `預覽`,
|
||||
tnopreview: `無`,
|
||||
};
|
||||
}
|
||||
// English
|
||||
if (lang.indexOf('-') && lang.indexOf('zh') === -1) {
|
||||
langurl = ctx.params.lang.replace('-', '/');
|
||||
textshow = {
|
||||
tprice: `Price`,
|
||||
tdiscount: `SAVE`,
|
||||
tplusfree: `Free For Plus`,
|
||||
tendtime: `Only in`,
|
||||
endtimeformat: `MM/DD/YYYY h:mm A`,
|
||||
treleasedate: `Release Date`,
|
||||
releasedateformat: `MMMM D, YYYY`,
|
||||
tsize: `File Size`,
|
||||
tdevice: `Playable On`,
|
||||
ttype: `Genre`,
|
||||
trating: `Rating`,
|
||||
tdescribe: `Description`,
|
||||
tpreview: `Preview`,
|
||||
tnopreview: `None`,
|
||||
};
|
||||
}
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://store.playstation.com/valkyrie-api/${langurl}/999/resolve/${gridName}?depth=2`,
|
||||
});
|
||||
const data = response.data;
|
||||
const item = data.included?.filter((item) => item.id === gridName) ?? [];
|
||||
ctx.state.data = {
|
||||
title: `PlayStation Store - ${item[0].attributes?.name ?? 'Unknown Name'}`,
|
||||
link: `https://store.playstation.com/${ctx.params.lang}/product/${gridName}`,
|
||||
item: item.map((item) => {
|
||||
let discount = '';
|
||||
// 折扣,另外这是选择带有特殊字符的JSON数据方法!
|
||||
let npdiscount = '';
|
||||
if (item.attributes['badge-info']['non-plus-user']) {
|
||||
npdiscount = `${textshow.tdiscount} ${item.attributes['badge-info']['non-plus-user']['discount-percentage']}%`;
|
||||
}
|
||||
if (
|
||||
(item.attributes['badge-info']['non-plus-user'] && item.attributes['badge-info']['non-plus-user']['discount-percentage'] === 100) ||
|
||||
(item.attributes['badge-info']['non-plus-user'] && item.attributes['badge-info']['non-plus-user']['discount-percentage'] === 0)
|
||||
) {
|
||||
npdiscount = `${textshow.tprice}:${item.attributes.skus[0].prices['non-plus-user']['actual-price'].display}`;
|
||||
}
|
||||
|
||||
// PLUS折扣
|
||||
let pdiscount = '';
|
||||
if (item.attributes['badge-info']['plus-user']) {
|
||||
pdiscount = `PLUS ${textshow.tdiscount} ${item.attributes['badge-info']['plus-user']['discount-percentage']}%`;
|
||||
}
|
||||
if (
|
||||
(item.attributes['badge-info']['plus-user'] && item.attributes['badge-info']['plus-user']['discount-percentage'] === 100) ||
|
||||
(item.attributes['badge-info']['plus-user'] && item.attributes['badge-info']['plus-user']['discount-percentage'] === 0)
|
||||
) {
|
||||
pdiscount = textshow.tplusfree;
|
||||
}
|
||||
|
||||
// 优惠时限&判断
|
||||
let endtime = ``;
|
||||
if (item.attributes.skus[0].prices['plus-user'].availability['end-date']) {
|
||||
endtime = `${textshow.tendtime} ${dayjs(item.attributes.skus[0].prices['plus-user'].availability['start-date']).format(textshow.endtimeformat)}--${dayjs(
|
||||
item.attributes.skus[0].prices['plus-user'].availability['end-date']
|
||||
).format(textshow.endtimeformat)}。<br><br>`;
|
||||
}
|
||||
// 价格,如果有折扣添加折扣信息至标题。
|
||||
let price = `${textshow.tprice}:${item.attributes.skus[0].prices['non-plus-user']['actual-price'].display} | PLUS${textshow.tprice}:${item.attributes.skus[0].prices['plus-user']['actual-price'].display}`;
|
||||
if (item.attributes['badge-info']['non-plus-user']) {
|
||||
price = `${textshow.tprice}:${item.attributes.skus[0].prices['non-plus-user']['actual-price'].display} | PLUS${textshow.tprice}:${item.attributes.skus[0].prices['plus-user']['actual-price'].display}<br><br>${endtime}`;
|
||||
discount = `|${npdiscount} | ${pdiscount}`;
|
||||
}
|
||||
|
||||
return {
|
||||
title: `${item.attributes.name}${discount}`,
|
||||
description: `${price}<br>${textshow.treleasedate}:${dayjs(item.attributes['release-date']).format(textshow.releasedateformat)}<br><br>
|
||||
${textshow.tsize}:${item.attributes['file-size'].value}${item.attributes['file-size'].unit}<br><br>
|
||||
${textshow.tdevice}:${item.attributes.platforms.join(', ')}<br><br>
|
||||
${textshow.ttype}:${item.attributes.genres.join(', ')}<br><br>
|
||||
${textshow.trating}:${item.attributes['star-rating'].score}<br><br>
|
||||
${textshow.tdescribe}:${item.attributes['long-description']}<br><br>
|
||||
${textshow.tpreview}:${item.attributes['media-list'].preview[0] ? `<video src="${item.attributes['media-list'].preview[0].url}" controls="controls" style="width: 100%"></video>` : textshow.tnopreview}`,
|
||||
link: `https://store.playstation.com/${ctx.params.lang}/product/${gridName}`,
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
@@ -1,60 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const url = require('url');
|
||||
const host = 'https://asia.playstation.com/';
|
||||
module.exports = async (ctx) => {
|
||||
const link = `https://asia.playstation.com/chs-hk/ps4/system-update/ps4-system-update-change-log/`;
|
||||
const response = await got.get(link, {
|
||||
responseType: 'buffer',
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
// let title = $('.psc-main-format-style').first().text();
|
||||
function sortDate(e) {
|
||||
// console.log(e);
|
||||
const pubday = e.substr(8, 2);
|
||||
const pubmonth = e.substr(5, 2);
|
||||
const pubyear = e.substr(0, 4);
|
||||
const pubdateString = pubmonth + `-` + pubday + `-` + pubyear;
|
||||
// console.log(pubdateString);
|
||||
return pubdateString;
|
||||
}
|
||||
const list = $('.layoutRowParsys ul li')
|
||||
.map(function () {
|
||||
const info = {
|
||||
title: $(this).find('span.psc-d-block').text(),
|
||||
link: $(this).find('a').attr('href'),
|
||||
date: sortDate($(this).find('span.psc-info-date').text()),
|
||||
};
|
||||
return info;
|
||||
})
|
||||
.get();
|
||||
const out = await Promise.all(
|
||||
list.map(async (info) => {
|
||||
const title = info.title;
|
||||
const date = info.date;
|
||||
const itemUrl = url.resolve(host, info.link);
|
||||
const cache = await ctx.cache.get(itemUrl);
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
const response = await got.get(itemUrl, {
|
||||
responseType: 'buffer',
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const description = $('.layoutRowParsys').html();
|
||||
const single = {
|
||||
title,
|
||||
link: itemUrl,
|
||||
description,
|
||||
pubDate: new Date(date).toDateString(),
|
||||
};
|
||||
ctx.cache.set(itemUrl, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: $('.psc-main-format-style').first().text(),
|
||||
link,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
'/monthly-games': ['justjustCC'],
|
||||
'/trophy/:id': ['DIYgod'],
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const baseUrl = 'https://www.playstation.com/en-sg/ps-plus/whats-new/';
|
||||
|
||||
const { data: response } = await got(baseUrl);
|
||||
const $ = cheerio.load(response);
|
||||
|
||||
const list = $('.cmp-experiencefragment--your-latest-monthly-games .box')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('h3').text(),
|
||||
description: `<img src="${item.find('.media-block__img source').attr('srcset')}" />${item.find('h3 + p').text()}`,
|
||||
link: item.find('.button a').attr('href'),
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'PlayStation Plus Latest Monthly Games',
|
||||
link: baseUrl,
|
||||
item: list,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
module.exports = {
|
||||
'playstation.com': {
|
||||
_name: 'PlayStation Store',
|
||||
www: [
|
||||
{
|
||||
title: 'PlayStation Monthly Games',
|
||||
docs: 'https://docs.rsshub.app/routes/game#playstation-store',
|
||||
source: ['/en-sg/ps-plus/whats-new'],
|
||||
target: '/ps/monthly-games',
|
||||
},
|
||||
{
|
||||
title: 'PlayStation Network user trophy',
|
||||
docs: 'https://docs.rsshub.app/routes/game#playstation-store',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/monthly-games', require('./monthly-games'));
|
||||
router.get('/trophy/:id', require('./trophy'));
|
||||
};
|
||||
@@ -336,27 +336,13 @@
|
||||
|
||||
## PlayStation Store {#playstation-store}
|
||||
|
||||
### Game List(Hong Kong) {#playstation-store-game-list-hong-kong}
|
||||
|
||||
<Route author="DIYgod" example="/ps/list/STORE-MSF86012-PLUS_FTT_CONTENT" path="/ps/list/:gridName" paramsDesc={['gridName from the list']} notOperational="1">
|
||||
Compatible with lists with an URL like `https://store.playstation.com/zh-hans-hk/grid/STORE-MSF86012-PLUS_FTT_CONTENT`. For instance [PSN Free to Play](https://store.playstation.com/zh-hans-hk/grid/STORE-MSF86012-PLUS_FTT_CONTENT), the gridName is `STORE-MSF86012-PLUS_FTT_CONTENT`
|
||||
</Route>
|
||||
|
||||
### Game Product Price {#playstation-store-game-product-price}
|
||||
|
||||
<Route author="MisteryMonster" example="/ps/product/UP9000-CUSA00552_00-THELASTOFUS00000" path="/ps/:lang/product/:gridName" paramsDesc={['region','gridName from the product']} radar="1" notOperational="1">
|
||||
Tested some countries, it should be work for most.
|
||||
|
||||
Compatible with Product with an URL like `https://store.playstation.com/en-us/product/HP4497-CUSA16570_00-ASIAFULLGAME0000`. For instance ['Cyberpunk 2077'](https://store.playstation.com/en-us/product/HP4497-CUSA16570_00-ASIAFULLGAME0000) the region is `en-us`, the gridName is `HP4497-CUSA16570_00-ASIAFULLGAME0000`
|
||||
</Route>
|
||||
|
||||
### PlayStation Network user trophy {#playstation-store-playstation-network-user-trophy}
|
||||
|
||||
<Route author="DIYgod" example="/ps/trophy/DIYgod_" path="/ps/trophy/:id" paramsDesc={['User ID']} radar="1" anticrawler="1" />
|
||||
|
||||
### PlayStation 4 System Update {#playstation-store-playstation-4-system-update}
|
||||
### PlayStation Monthly Games {#playstation-store-playstation-monthly-games}
|
||||
|
||||
<Route author="Jeason0228" example="/ps/ps4updates/" path="/ps/ps4updates/" radar="1" notOperational="1" />
|
||||
<Route author="justjustCC" example="/ps/monthly-games" path="/ps/monthly-games" />
|
||||
|
||||
## psnine {#psnine}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user