feat(ps): use art

This commit is contained in:
DIYgod
2024-01-13 19:44:45 +08:00
parent 351fa2cc45
commit 020a763fa4
3 changed files with 10 additions and 4 deletions
+7 -2
View File
@@ -1,5 +1,7 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const path = require('path');
const { art } = require('@/utils/render');
module.exports = async (ctx) => {
const baseUrl = 'https://www.playstation.com/en-sg/ps-plus/whats-new/';
@@ -13,13 +15,16 @@ module.exports = async (ctx) => {
item = $(item);
return {
title: item.find('h3').text(),
description: `<img src="${item.find('.media-block__img source').attr('srcset')}" />${item.find('h3 + p').text()}`,
description: art(path.join(__dirname, 'templates/monthly-games.art'), {
img: item.find('.media-block__img source').attr('srcset'),
text: item.find('h3 + p').text(),
}),
link: item.find('.button a').attr('href'),
};
});
ctx.state.data = {
title: 'PlayStation Plus Latest Monthly Games',
title: 'PlayStation Plus Monthly Games',
link: baseUrl,
item: list,
};
+2 -2
View File
@@ -3,13 +3,13 @@ module.exports = {
_name: 'PlayStation Store',
www: [
{
title: 'PlayStation Monthly Games',
title: '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',
title: 'User trophy',
docs: 'https://docs.rsshub.app/routes/game#playstation-store',
},
],
+1
View File
@@ -0,0 +1 @@
<img src="{{ img }}" />{{ text }}