Files
RSSHub/lib/routes/ff14/ff14_zh.js
Kiokh 982268b42b feat: Rss feed for Final Fantasy XIV (CN) (#2678)
* Add: Final_Fantsy_XIV_ zh

* fix: wrong change
2019-07-24 11:59:25 +08:00

39 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');
module.exports = async (ctx) => {
const referer = 'http://ff.sdo.com/web8/index.html';
const type = ctx.params.type;
const type_number = {
news: '5310',
announce: '5312',
events: '5311',
advertise: '5313',
all: '5310,5312,5311,5313,5309',
};
const response = await got({
method: 'get',
url: `http://api.act.sdo.com/UnionNews/List?gameCode=ma&category=${type_number[type]}&pageIndex=0&pageSize=50`,
headers: {
Referer: referer,
},
});
const data = response.data.Data;
ctx.state.data = {
title: '最终幻想14国服新闻中心',
link: referer + '#/newstab/newslist',
description: '《最终幻想14》是史克威尔艾尼克斯出品的全球经典游戏品牌FINAL FANTASY系列的最新作品IGN获得9.2高分全球累计用户突破1600万',
item: data.map(({ Title, Summary, Author, PublishDate, HomeImagePath }) => ({
title: Title,
link: Author,
description: `
<img referrerpolicy="no-referrer" src="${HomeImagePath}"><br>
${Summary}<br>
${PublishDate}`,
})),
};
};