From 020a763fa40a3456247332bf4f848fee82339717 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Sat, 13 Jan 2024 19:44:45 +0800 Subject: [PATCH] feat(ps): use art --- lib/v2/ps/monthly-games.js | 9 +++++++-- lib/v2/ps/radar.js | 4 ++-- lib/v2/ps/templates/monthly-games.art | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 lib/v2/ps/templates/monthly-games.art diff --git a/lib/v2/ps/monthly-games.js b/lib/v2/ps/monthly-games.js index b28553c439..978a79c8a6 100644 --- a/lib/v2/ps/monthly-games.js +++ b/lib/v2/ps/monthly-games.js @@ -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: `${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, }; diff --git a/lib/v2/ps/radar.js b/lib/v2/ps/radar.js index 98427a5fb5..3e62655eea 100644 --- a/lib/v2/ps/radar.js +++ b/lib/v2/ps/radar.js @@ -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', }, ], diff --git a/lib/v2/ps/templates/monthly-games.art b/lib/v2/ps/templates/monthly-games.art new file mode 100644 index 0000000000..f14428b9b2 --- /dev/null +++ b/lib/v2/ps/templates/monthly-games.art @@ -0,0 +1 @@ +{{ text }}