RSSHub/lib/v2/nintendo/eshop_us.js

33 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 { art } = require('@/utils/render');
const got = require('@/utils/got');
const path = require('path');
module.exports = async (ctx) => {
const response = await got.post('https://u3b6gr4ua3-dsn.algolia.net/1/indexes/store_game_en_us_release_des/query', {
headers: {
'x-algolia-api-key': 'a29c6927638bfd8cee23993e51e721c9',
'x-algolia-application-id': 'U3B6GR4UA3',
},
json: {
params: new URLSearchParams({
hitsPerPage: 40,
page: 0,
facetFilters: JSON.stringify([['availability:Available now', 'availability:Pre-order']]),
}).toString(),
},
});
const data = response.data.hits;
ctx.state.data = {
title: `Nintendo eShop美服新游戏`,
link: `https://www.nintendo.com/store/games/`,
description: `Nintendo eShop美服新上架的游戏`,
item: data.map((item) => ({
title: item.title,
description: art(path.join(__dirname, 'templates/eshop_us.art'), item),
link: `https://www.nintendo.com${item.url}`,
})),
};
ctx.state.json = response.data;
};