diff --git a/docs/game.md b/docs/game.md index 46a637cd3..577afd0ba 100644 --- a/docs/game.md +++ b/docs/game.md @@ -707,7 +707,7 @@ Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547` -| 最新 | 新闻 | 公告 | 活动 | +| 最新 | 新闻 | 公告 | 活动 | | -------- | ---- | ------ | -------- | | news-all | news | notice | activity | diff --git a/lib/v2/mihoyo/radar.js b/lib/v2/mihoyo/radar.js index 5888de9de..40e1df778 100644 --- a/lib/v2/mihoyo/radar.js +++ b/lib/v2/mihoyo/radar.js @@ -14,9 +14,9 @@ module.exports = { title: '崩坏:星穹铁道 - 新闻', docs: 'https://docs.rsshub.app/game.html##mi-ha-you', source: '/:location/news', - target: '/mihoyo/sr/:location' + target: '/mihoyo/sr/:location', }, - ] + ], }, 'mihoyo.com': { _name: '米哈游', @@ -51,7 +51,7 @@ module.exports = { title: '崩坏:星穹铁道 - 新闻', docs: 'https://docs.rsshub.app/game.html##mi-ha-you', source: '/news', - target: '/mihoyo/sr' + target: '/mihoyo/sr', }, ], ys: [ diff --git a/lib/v2/mihoyo/sr/news.js b/lib/v2/mihoyo/sr/news.js index cf3bc23e8..19a258ea7 100644 --- a/lib/v2/mihoyo/sr/news.js +++ b/lib/v2/mihoyo/sr/news.js @@ -2,39 +2,39 @@ const got = require('@/utils/got'); const { parseDate } = require('@/utils/parse-date'); const categories = { - 'zh-cn':{ - 'news-all':{ + 'zh-cn': { + 'news-all': { id: '255', title: '最新', }, - news:{ + news: { id: '256', - title: '新闻' + title: '新闻', }, - notice:{ + notice: { id: '257', title: '公告', }, - activity:{ + activity: { id: '258', title: '活动', }, link: 'https://sr.mihoyo.com/news', }, - 'zh-tw':{ - 'news-all':{ + 'zh-tw': { + 'news-all': { id: '248', title: '最新', }, - news:{ + news: { id: '249', - title: '資訊' + title: '資訊', }, - notice:{ + notice: { id: '250', title: '公告', }, - activity:{ + activity: { id: '251', title: '活動', }, @@ -47,28 +47,25 @@ module.exports = async (ctx) => { const { location = 'zh-cn', category = 'news-all' } = ctx.params; const limit = ctx.query.limit ? parseInt(ctx.query.limit) : 50; let url = ''; - if (location === 'zh-cn') - { + if (location === 'zh-cn') { url = `https://api-takumi-static.mihoyo.com/content_v2_user/app/1963de8dc19e461c/getContentList?iPage=1&iPageSize=${limit}&sLangKey=zh-cn&isPreview=0&iChanId=${categories[location][category].id}`; - } - else - { + } else { url = `https://api-os-takumi-static.hoyoverse.com/content_v2_user/app/113fe6d3b4514cdd/getContentList?iPage=1&iPageSize=${limit}&sLangKey=${location}&isPreview=0&iChanId=${categories[location][category].id}`; - }; + } const response = await got(url); const list = response.data.data.list; const items = list.map((item) => ({ - title: item.sTitle, - description: item.sContent, - link: `${categories[location].link}/${item.iInfoId}`, - pubDate: parseDate(item.dtStartTime), - category: item.sCategoryName - })); + title: item.sTitle, + description: item.sContent, + link: `${categories[location].link}/${item.iInfoId}`, + pubDate: parseDate(item.dtStartTime), + category: item.sCategoryName, + })); ctx.state.data = { title: `${categories[location][category].title}-崩坏:星穹铁道`, link: url, item: items, }; -}; \ No newline at end of file +};