mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat(ps): use art
This commit is contained in:
@@ -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
@@ -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',
|
||||
},
|
||||
],
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<img src="{{ img }}" />{{ text }}
|
||||
Reference in New Issue
Block a user