RSSHub/lib/v2/nintendo/eshop_jp.js

35 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
const { art } = require('@/utils/render');
const path = require('path');
module.exports = async (ctx) => {
const response = await got('https://search.nintendo.jp/nintendo_soft/search.json', {
searchParams: {
opt_sshow: 1,
fq: 'ssitu_s:onsale OR ssitu_s:preorder OR memo_bg:forced',
limit: ctx.query.limit ? Number(ctx.query.limit) : 24,
page: 1,
c: '50310840317994813',
opt_osale: 1,
opt_hard: '1_HAC',
sort: 'sodate desc,score',
},
});
const data = response.data.result.items;
ctx.state.data = {
title: 'Nintendo eShop日服新游戏',
link: 'https://www.nintendo.co.jp/software/switch/index.html',
description: 'Nintendo eShop日服新上架的游戏',
item: data.map((item) => ({
title: item.title,
description: art(path.join(__dirname, 'templates/eshop_jp.art'), {
item,
}),
link: `https://ec.nintendo.com/JP/ja/titles/${item.id}`,
pubDate: parseDate(item.pdate),
})),
};
};